Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer

The syslogd manpage states that the exclamation mark is used as a notation for excluding specified priorities, and that "You may use it intuitively as an exception specifier". The example given is

mail.*;mail.!=info              /usr/adm/mail

which would log all mail messages except those with "info" priority. So, for your problem, I'd use

*.*;local0.!debug;auth,authpriv.none /var/log/syslog

or, more readable,

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

However, you should be aware that I was not able to test this.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.