PhoenixMage wrote:Hi Guys,
I am wondering if it is possible to configure rsyslog to log a message only once on first match rather then continuing to process.
My logic is I want a catch all at the bottom of my file logging every that I havent specifically logged previously.
I am running version 3.19.9.
Cheers,
Tony
In a kind of roundabout way, yes.
Giving the tilde (~) as an action causes that message to be discarded. There's also the ampersand syntax - if a line starts with & it is considered an additional action for the previous line's selector. So something like this:
- Code: Select all
mail.* /var/log/mail.log
& ~
kern.* /var/log/kern.log
& ~
*.* /var/log/catchall
Would log all mail messages to /var/log/mail.log, then drop them. Kernel messages to /var/log/kern.log, and then gone. Whatever's left goes in /var/log/catchall.
-HKS