抑制rsyslog tls错误消息

使用tlsconfigurationstreamdriver.authmode并使用PermittedPeerstreamdriver.authmode名称时,如果未经授权的对端连接,rsyslog会logging下面的错误消息。

 Jan 22 08:56:38 test rsyslogd-2089: netstream session 0x7f177401b740 from 10.0.0.7 will be closed due to error [try http://www.rsyslog.com/e/2089 ] Jan 22 08:56:38 test rsyslogd-2088: error: peer name not authorized - not permitted to talk to it. Names: DNSname: *.test.com; DNSname: test.com; CN: *.test.com; [try http://www.rsyslog.com/e/2088 ] 

如果客户端是持久的,rsyslog会logging数以千计的这些消息。

有没有办法告诉netstream驱动程序不logging太多这些? 我不介意看到他们弄清楚哪个客户端configuration错误或可能被滥用,但是这些客户端太多了。

我目前正在使用下面的条目,完全丢弃这些消息。

 :msg, contains, "peer name not authorized" ~ :msg, regex, ".*netstream session .* from .* will be closed due to error" ~ 

顺便说一下,这将产生下面的警告消息,即使最近的文档说这是丢弃消息的正确方法。

 Jan 22 09:34:22 test: warning: ~ action is deprecated, consider using the 'stop' statement instead [try http://www.rsyslog.com/e/2307 ] 

看来你要实现RepeatedMsgReduction 。

在你的全局configuration指令(可能是rsyslog.conf )中:

 $RepeatedMsgReduction on 

从文档:

该指令指定是否应该减less重复的消息(这是“最后一行重复n次”function)。 如果设置为打开,重复的消息将减less。 如果设置为closures,则会logging每条消息。