How to keep haproxy log messages out of /var/log/syslog

haproxyrsyslog

I set up haproxy logging via rsyslogd using the tips from this article, and everything seems to be working fine. The log files get the log messages.

However, every log message from haproxy also shows up at /var/log/syslog. This means that once the server goes live, the syslog will be quite useless, as it will be run over with haproxy log messages.

I would like to filter out those messages from /var/log/syslog. After going over the rsyslogd documentation, I tried to change the file /etc/rsyslog.d/50-default.conf thus:

*.*;auth,authpriv.none;haproxy.none     -/var/log/syslog

I simply added the ;haproxy.nonepart. After restarting rsyslogd it stopped working completely until I reverted my changes.

What am I doing wrong?

Best Answer

You could also do the following which will make it so they don't go in any other logs:

local0.*                        -/var/log/haproxy.log
& ~

The & ~ means not to put what matched in the above line anywhere else for the rest of the rules.