syslog-ng:过滤未分类的消息

我设置了一个configuration,将消息分类并写入相应的文件(目的地)。 我想知道 – 是否有可能login到一个文件没有被特定的filter抓住的消息?

例如,有用于dhcpddhclientacpidsshd消息的filter。 而我想要的是抓住不属于上述所有四类的信息。

我看到tags是可用的内部每邮件结构。 我试图为每个类别设置一个标记,并像这样抓取标记:

 rewrite r_set_routed { set-tag('routed'); }; filter f_untagged { not tags('routed'); }; filter f_dhcpd_program { program('dhcpd'); }; <...> log { source(s_local); rewrite(r_set_routed); filter(f_dhcpd_program); destination(d_dhcpd_file); }; <...> log { source(s_local); filter(f_untagged); destination(d_unfiltered_file); }; 

但是这不起作用(看起来像r_set_routed重写在一个log {}不会影响其他log {} )。 我知道有可能否定所有的filter来产生不匹配所有以上的filter,但这是我想避免的容易出错和肮脏的方式。

在具有filter的日志path中使用“flags(final)”选项,并在最后使用未标记消息的日志path。 这最后一个日志path将不需要filter或标志。 有关详细信息,请参阅https://www.balabit.com/documents/syslog-ng-ose-latest-guides/en/syslog-ng-ose-guide-admin/html/reference-logflags.html