
複数の一致値を持つ単一のルールを記述し、メッセージに最初の単語または 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 式のドキュメント少しは役に立つかもしれません。