How do I squelch specific messages from being logged in syslog?
Matthew Barrera
I'm troubleshooting a problem of system hangs and want to know what's being logged just before the system freeze occurs. This effort is being hampered because my VPN provider (PIA) is logging gobs of information messages every minute. I'd like to have a lot less clutter on the shell window when things lock up.
I've tried adding something like various permutations of the following to rsyslog.conf
pia-daemon.info /dev/null
pia*.info /dev/nullI'd like to avoid creating additional conf files if possible. I do not want to suppress all info messages, just these. Ideas?
1 Answer
You can use the stop keyword action to end processing of a message. To match the message you need to know where the pia-daemon string appears in the input. It might be the tag, or it might be $programname. You can try
if $syslogtag=="pia-daemon:" then stop
if $programname=="pia-daemon" then stopTo find out you could list all the fields using a builtin template RSYSLOG_DebugFormat:
*.info /var/log/debug;RSYSLOG_DebugFormatOr you can just look anywhere in the raw input:
if $rawmsg contains "pia-daemon" then stopMake sure these filters appear early in the config file, before other filters.