Replace 为什么不使用rsyslog执行字符串替换?

Replace 为什么不使用rsyslog执行字符串替换?,replace,rsyslog,Replace,Rsyslog,rsyslogd 8.24 我正在尝试为此日志执行字符串替换: 这是收到的$msg: [malware3] IN=ens192 OUT=ens192 MAC=00:50:56:... 通过使用此配置rsyslog.d/log.conf: if ($msg contains "[malware3]") then { $template mytemplate_log, " <mytemplate> %msg% "

rsyslogd 8.24

我正在尝试为此日志执行字符串替换:

这是收到的$msg:

[malware3] IN=ens192 OUT=ens192 MAC=00:50:56:...
通过使用此配置rsyslog.d/log.conf:

if ($msg contains "[malware3]") then
{
        $template mytemplate_log, " <mytemplate> %msg% "
        $!msg = replace($msg, "[malware3]", "ANOTHERSTRING");
        /data/log/mylog.log;mytemplate_log
        stop
}
如果($msg包含“[malware3]”),则
{
$template mytemplate_日志,“%msg%”
$!msg=replace($msg,“[malware3]”,另一个字符串);
/data/log/mylog.log;mytemplate\u log
停止
}
但结果是:

<mytemplate> [malware3] IN=ens192 OUT=ens192 MAC=00:50:56:...
[malware3]IN=ens192 OUT=ens192 MAC=00:50:56:。。。
如您所见,应用了模板,但没有替换。 有什么问题吗

谢谢