rsyslog で and , not , or など否定や、和集合(OR)積集合(AND)はどう書くのか
rsyslog で否定
A̅ / not A / 否定
if not ( $msg contains "moby" ) then { *.* action(type="omfwd" ... ) }
A ∪ B / not ( A or B )
if not ( $msg contains "moby" or $msg contains "docker" ) then { *.* action(type="omfwd" ... ) }
A̅ ∩ B̅ / not A and not B
if not ( $msg contains "moby" ) and ( not $msg contains "docker" ) then { *.* action(type="omfwd" ... ) }
not と括弧は、not () / ( not cond )
のどちらでも動いた。
利用例 / docker ログを転送しない。
docker が大量のログを吐き出す。 docker のログは強烈。mount 系のログは大量になるので、転送しないようにしたい。
docker のログがすごい数。
cat daemon.log | grep -P 'docker|moby' | wc -l 10230
半日でこれですわ。docker のログはキ◯ガイ何じゃないかと思ったり。