I'm trying to write rsyslog messages received from a specific host to a log file based on the message content. Let's say I'd like to send messages received from "myserver" that contains the pattern "supertext\d{1,4}" to /var/log/myserver-supertext.log, I'd go with:
if $fromhost=='myserver' AND $msg contains 'supertext\d{1,4}' then /var/log/myserver-supertext.log
& stop
Unfortunately, expression-based filters in rsyslog do not seem to support regexp, and I was trying to figure out how to do the same thing with property based filters, which support regexp. I was thinking about something like:
:fromhost, isequal, "myserver" AND :msg, regex, "supertext\d{1,4}" /var/log/myserver-supertext.log
& stop
I know it doesn't work that way and I'll appreciate it if you have an idea on how to do it.