
여러 일치 값이 포함된 단일 규칙을 작성하는 방법을 찾고 있습니다. 메시지에 첫 번째 단어나 두 번째 단어가 포함되어 있으면 해당 행을 로그 파일에 쓰지 마세요.
이것은 작동하지만 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 표현식 문서조금 도움이 될 수 있습니다.