2

I'd like to redirect all messages from dhcpd to their own log file, rather than having them appear in /var/log/messages.

Here is the configuration on /etc/syslog.conf:

!dhcpd
*.*                     /var/log/dhcpd.log

The messages are redirected to dhcpd.log, but they're also going to /var/log/messages.

What's the configuration to exclude them from /var/log/messages?

PatrikN
  • 155
  • 6
Dave
  • 143
  • 1
  • 7

1 Answers1

3

`!-prog' specification will match any message but the ones from that program:

!-dhcpd
*.err;kern.*;auth.notice;authpriv.none;mail.crit         /dev/console
*.info;mail.none;authpriv.none       /var/log/messages
......

!dhcpd
*.*                     /var/log/dhcpd.log
alvosu
  • 8,357
  • 24
  • 22
  • Works perfectly! Thanks :). One thing that also works, is to add the specification at the end of the filter, like this: `*.=info; *.=notice; *.=warn; auth,authpriv.none; cron,daemon.none; mail,news.none; !-dhcpd -/var/log/messages` – ivanleoncz Feb 19 '18 at 22:05
  • Doesn't seem to work on CentOS 7: `rsyslogd[42184]: BSD-style blocks are no longer supported in rsyslog, see http://www.rsyslog.com/g/BSD for details and a solution (Block '!dhcpd') [v8.24.0-34.el7 try http://www.rsyslog.com/e/2304 ]` – antivirtel Oct 07 '19 at 15:47