rsyslog 単一フィルタ条件構文

rsyslog 単一フィルタ条件構文

複数の一致値を持つ単一のルールを記述し、メッセージに最初の単語または 2 番目の単語が含まれている場合はそれらの行をログ ファイルに書き込まない方法を探しています。

これは機能しますが、DRYではありません:

if $msg contains "WARNING:" then { Action (type="omfile" File="/var/log/ignorethis") stop }
if $msg contains "IGNORE THIS MESSAGE:" then { Action (type="omfile" File="/var/log/ignorethis") stop }

これは機能しません:

if $msg contains "WARNING: || IGNORE THIS MESSAGE:" then { Action (type="omfile" File="/var/log/ignorethis") stop }

答え1

これは機能しますか?

if ($msg contains "WARNING:") or ($msg contains "IGNORE THIS MESSAGE:") then { Action (type="omfile" File="/var/log/ignorethis") stop }

rsyslog 式のドキュメント少しは役に立つかもしれません。

関連情報