Rsyslog:如何在 if-then 语句中否定“包含”

che*_*eng 1 rsyslog

if $programname == "service" then {
     if $msg !contains "test" then
         action(type="omfwd" 
            target="10.0.0.5"
            ...
            ) 
}
Run Code Online (Sandbox Code Playgroud)

我试图排除包含单词 'test' 的消息。不知道如何否定“包含”。

文档来看,它似乎是“!包含”。尝试过但没有运气。

任何想法?

meu*_*euh 8

!否定语法适用于以下形式的遗留选择器

:msg, !contains, "test"  /some/file
Run Code Online (Sandbox Code Playgroud)

您正在使用 RainerScript,因此适当的语法是关键字not

if not ($msg contains "test") then
Run Code Online (Sandbox Code Playgroud)