How can we stop a certain process from writing to the messages log?
By configuring that logging options of that process, i.e. make it log to file instead of to STDOUT or syslog or configure the log level to be less verbose/silent.
Alternatively since you appear to be using rsyslog:
Rsyslogd supports filter conditions, one of which, the ~
is to silently discard messages that match a specific pattern:
Using negation can be useful if you would like to do some generic processing but exclude some specific events. You can use the discard action in conjunction with that. A sample would be:
*.* /var/log/allmsgs-including-informational.log
:msg, contains, "informational" ~
*.* /var/log/allmsgs-but-informational.log
Do not overlook the tilde ~in line 2! In this sample, all messages are written to the file allmsgs-including-informational.log
.
Then, all messages containing the string “informational” are discarded. That means the config file lines below the “discard line” (number 2 in our sample) will not be applied to this message. Then, all remaining lines will also be written to the file allmsgs-but-informational.log
.