我想停止 rsyslog 记录这些消息。
[168707.740364] TCP: Peer 192.168.100.1:46199/41503 unexpectedly shrunk window 2027330493:2027331431 (repaired)
我在 /etc/rsyslog.conf 中尝试了这个,但仍然记录了消息。
if $msg contains 'unexpectedly' then /dev/null
任何人都可以指出我正确的方向吗?
Kar*_*rlo 10
如果您使用最新版本的 rsyslog(例如 7),则需要执行
& stop
Run Code Online (Sandbox Code Playgroud)
在您留言之后。不这样做会给你
warning: ~ action is deprecated, consider using the 'stop' statement instead [try http://www.rsyslog.com/e/2307 ]
Run Code Online (Sandbox Code Playgroud)
rsyslog 需要一个语句来在匹配后停止记录。在您已有的 if 语句之后立即添加此行。
& ~
Run Code Online (Sandbox Code Playgroud)
您可能还需要在 conf 文件中向上移动这两个语句,以便在其他一些可能将它们记录到消息的语句之前解析它们。我将我的 rsyslog 配置更改为如下所示
/etc/rsyslog.conf ($IncludeConfig /etc/rsyslog.d/*.conf)
/etc/rsyslog.d/40-specificdaemon.conf
/etc/rsyslog.d/99-general.conf
Run Code Online (Sandbox Code Playgroud)
这确保了我想要的顺序,并使配置管理更容易推送更新。
| 归档时间: |
|
| 查看次数: |
34120 次 |
| 最近记录: |