我想使用正则表达式过滤IP地址并触发模板名称“ DynFile”或“ HostnameDynFile”。有人可以请教吗?
template (name="DynFile" type="string" string="/opt/log/%FROMHOST-IP%/syslog.log")
template (name="HostnameDynFile" type="string" string="/opt/log/%HOSTNAME%/syslog.log")
if $fromhost-ip regex '\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4}\b' then {
action(type="omfile" dynaFile="DynFile"
} else { action(type="omfile" dynaFile="HostnameDynFile" }