Exclude syslog facility from all others

loggingsyslog

I'm adding some custom logging on local0 in syslog.

Writing these messages to a specific log is easy, in my syslog.conf I have

local0.* -/var/log/my.log

But how can I exclude local0 from all other logs? In my current setup, local0 messages also show up in /var/log/syslog since it's specified as

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

Do I need to go through all the other default logs and add local0.none, or is there some kind of global exclude I can use?

Best Answer

In syslog I'm afraid your assumption is right, you have to do it by adding local0.none to each syslog line you don't want local0 in.

If you're looking for other options rsyslog is all in nowadays (all the cool kids love it), and will actually let you do what you're asking for (check here).

Also syslog-ng allows you to do what you're asking for, and have some pretty cool filtering by strings even (check here), I use it for advanced syslogging on my log collector server.