NAS4Free in the Role of Syslog Server

Illustration

In 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.

[2018-07-22: NAS4Free has been renamed to XigmaNAS as of July 2018]