rsyslogで文字列とfacilityでfilterする

監視サーバやLBからの死活監視のログが出続けるのが嫌なので、facilityごとに特定の文字列を含まないものだけログに出したいなーと思っていたら、rsyslogのdocumentにそのままの例がのっていた。

if $syslogfacility-text == 'local0' and $msg startswith 'DEVNAME' and not ($msg contains 'error1' or $msg contains 'error0') then /var/log/somelog

"If you would like to do case-insensitive comparisons, use "contains_i" instead of "contains" and "startswith_i" instead of "startswith"."

とあるように、この構文中には正規表現regex,ereregexが使用できないことに注意する。