On Wed, 30 Mar 2011, Roland Kamke wrote:

A newbie question: Is it possible to use values matching a regular
expression in a comparison?

Imagine I receive messges like this: "disk usage of /dev/sdb2 is 60%",
"disk usage of /dev/sda3 is 80%", etc. All match the regular expression
"disk usage of [/a-zA-Z0-9]* is [0-9]*%". I do not want to log all these
messages, but only those where disk usage is at least 75 per cent.
Can this be achieved by proper configuration?

yes, you would do three regex matches

first look for values between 75% and 79%

"disk usage of [/a-zA-Z0-9]* is 7[5-9]%"

then look for values between 80% and 99%

"disk usage of [/a-zA-Z0-9]* is [8-9][0-9]%"

and finally look for 100%

"disk usage of [/a-zA-Z0-9]* is 100%"

it may be possible to combine these with something similar to

"disk usage of [/a-zA-Z0-9]* is (7[5-9]|[8-9][0-9]|100)%"

but having three separate tests is clearer to many people

Where to look in the documentation?

look for regex matches.

David Lang
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com

Reply via email to