I want to redirect the following messages into the log file:
"[example]:[foo][bar]: "
"[example]:[foo][hello]: "
"[example]:[foo][world]: "
"[example]:[foo][other]: "
"[example]:[foo][text]: "
The content in the 3rd field is dynamic text which contains lowercase [a-z] only:
"[example]:[foo][.*]: "
It works if I create the rsyslog conf file with the "contains" keyword:
:msg, contains, "[example]:[foo]" -/var/log/example.log
But the following regex is not work at all, no any message is logged:
:msg, regex, "\[example\]\:\[foo\]\[.*\]\:\ " -/var/log/example.log
What's wrong in my regex?
How to write the correct regex for matching the above messages with including all required fields?