Rsyslog:如何在 if-then 语句中否定'contains'


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

如果邮件包含单词"测试",我将尝试排除该邮件。不确定如何否定"contains"。

从文件上看,它似乎是'!包含"。尝试过,但没有成功。

知道吗?

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

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

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

if not ($msg contains "test") then

最新更新