Mar 182014
 

NAS4Free - Syslog serverIn my network there are multiple *nix devices, most notable of them being my file server (NAS4Free) and my router (Asus RT-AC56U). Nice thing about their common ancestry is that both support syslog logging. Since I already have a proper reporting in place for my file server, I started thinking about getting my router messages there too.

Well, as luck would have it, there is already a syslog server present within NAS4Free. Only reason why it doesn’t work is that it is explicitly disabled in /etc/rc.d/syslogd. Following line is the culprit:

syslogd_flags="-8 -ss"

In full NAS4Free installation it is simple to edit that file. In embedded, some “trickery” is needed. In System -> Advanced -> Command scripts I added a new PostInit entry:

sed -i -e 's^syslogd_flags=".*"^syslogd_flags="-8 -a 192.168.1.0/24:*"^g' /etc/rc.d/syslogd ; /etc/rc.d/syslogd restart

Purpose of this rather long command (ok, two commands) is to do a string replace of default flags with ones allowing the whole 192.168.1.x range to use it as a server (you could define single server too).

There are additional steps that could be taken, e.g. adding host name into /etc/hosts or getting syslog to save my router messages into separate log file (configurable in /etc/syslog.conf). However, as far as my needs went, I was perfectly fine with this.

  3 Responses to “NAS4Free in the role of syslog server”

Comments (3)
  1. Thanks for the post – I now have my my router messages (from 192.168.1.1) going to my N4F server. However, I would like them to be sent into a separate log file. How is this done via syslog.conf, and how can I keep it after a N4F reboot? (I have an embedded install)

  2. In answer to Jim’s question, use sed as a PostInit command to add the -f switch and point it to your preconfigured syslog.conf. In this, you’ll specify a separate logfile for what you need, this will need to reside on a mountpoint for it to persist on reboots (man syslog).

  3. I followed this to get my NAS4Free to host ddwrt router logs.

    Although my router logs are showing with timestamps 12 hours ahead of the current time.

    Both machines have the correct time and timezone setup. Any ideas?

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>