Freebsd – syslogd filtering not working on FreeBSD

filterfreebsdsyslogsyslogd

I am failing to get filtering by program or facility working in FreeBSD syslogd.

I added

local6.debug            /var/log/test.log
!testd
*.debug                 /var/log/test.log

to my /etc/syslog.conf and restarted the syslog daemon.

I then wrote a little Go program testd that sends a "debug" message to syslogd (facility "user") and then sent an additional message using logger -p local6.debug "msg". The first message was only logged to /var/log/messages (according to the default rules), but not to /var/log/test.log, the second one was not logged at all.

It seems the rules are being ignored?

Best Answer

It seems that your log messages are sent to /var/log/debug.log because of this line : *.=debug /var/log/debug.log

You can either :

  • Use another priority for your tests (eg notice instead of debug)
  • Change the order so that your lines are before the one referring to debug.log