deusx
New Around Here
I am interested in forwarding the syslog entries to another host, a synology NAS. Forwarding works fine, as well as the loglevel options. The issue I'm facing is that during boot and until init the hostname is not initialised early enough to ensure that the log entries will be tagged with the hostname and the initial ones start with the router's LAN IP for example. Also, I would need to restart the syslogd without the -S option to ensure consistency with other logs from the system. End result is that the remote syslog is populated with numerous ungrouped log entries from the corresponding logging components.
In short I want to group all the router log entries under the tag that will be the router's hostname.
What I've tried so far:
In order to initialise the hostname early enough to be picked before syslogd commences I echo the hostname to /proc/sys/kernel/hostname in init-start. That solves partially the problem, as the kernel logs prior to starting the syslogd were not tagged with the hostname.
I also set log_level, console_loglevel and message_loglevel to 0, between init-start and services-start in order to ensure zero logging until I restart the syslogd in services-start without the -S option.
The point which syslogd behaves as intended is right after services-start where I cycle the logging services and restart the daemon with the desired options, verbosity and hostname, assuming that syslogd will never crash. But I'm losing all boot, kernel, and syslog messages until this point.
So, which would be the best strategy to forward all logging from the router to the remote host, preferably from boot, all tagged with the router's hostname?
I guess, a clean, short solution would be to just tune the kernel boot args, so that boot logs as well as syslog logs later on will all be tagged with the hostname. Is there a way to tune that?
Anything else, that involves jffs scripts seems a hack to me, that partially works. Especially because all the intended parts which need to be modified are hardcoded and not configurable, e.g. syslogd options, the order which syslogd is launched in init in relation to where sethostname() is called, etc.
In short I want to group all the router log entries under the tag that will be the router's hostname.
What I've tried so far:
In order to initialise the hostname early enough to be picked before syslogd commences I echo the hostname to /proc/sys/kernel/hostname in init-start. That solves partially the problem, as the kernel logs prior to starting the syslogd were not tagged with the hostname.
I also set log_level, console_loglevel and message_loglevel to 0, between init-start and services-start in order to ensure zero logging until I restart the syslogd in services-start without the -S option.
The point which syslogd behaves as intended is right after services-start where I cycle the logging services and restart the daemon with the desired options, verbosity and hostname, assuming that syslogd will never crash. But I'm losing all boot, kernel, and syslog messages until this point.
So, which would be the best strategy to forward all logging from the router to the remote host, preferably from boot, all tagged with the router's hostname?
I guess, a clean, short solution would be to just tune the kernel boot args, so that boot logs as well as syslog logs later on will all be tagged with the hostname. Is there a way to tune that?
Anything else, that involves jffs scripts seems a hack to me, that partially works. Especially because all the intended parts which need to be modified are hardcoded and not configurable, e.g. syslogd options, the order which syslogd is launched in init in relation to where sethostname() is called, etc.