Rsyslog:如何否定if-then语句中的“ contains”

时间:2018-11-29 18:34:12

标签: rsyslog

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

我正在尝试排除包含“测试”一词的味精。不确定如何否定“包含”。

document中,它似乎是“!包含”。尝试了一下,但没有运气。

有什么主意吗?

1 个答案:

答案 0 :(得分:1)

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

:msg, !contains, "test"  /some/file

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

if not ($msg contains "test") then
相关问题