【发布时间】:2019-06-19 22:29:48
【问题描述】:
在 rsyslog 配置文件中,我们配置为所有应用程序日志都将写入 /var/log/messages 但日志以非常高的速率写入,如何降低应用程序级别的日志记录级别
【问题讨论】:
在 rsyslog 配置文件中,我们配置为所有应用程序日志都将写入 /var/log/messages 但日志以非常高的速率写入,如何降低应用程序级别的日志记录级别
【问题讨论】:
希望这是您正在寻找的。 在文本编辑器中打开文件:
/etc/rsyslog.conf
将以下参数更改为您认为对您有益的参数:
$SystemLogRateLimitInterval 3
$SystemLogRateLimitBurst 40
重启 rsyslogd
service rsyslog restart
$InputFilePollInterval 等价于:“PollingInterval”
PollingInterval seconds
Default: 10
This setting specifies how often files are to be polled for new data.
The time specified is in seconds. During each polling interval, all
files are processed in a round-robin fashion.
A short poll interval provides more rapid message forwarding, but
requires more system resources. While it is possible, we stongly
recommend not to set the polling interval to 0 seconds
.
【讨论】:
有几种方法可以解决这个问题,这取决于您究竟想要做什么,但您可能希望查看separating your facilities into separate output files, based on severity。这可以在您的配置文件中使用RFC5424 severity priority levels 来完成。
通过按设施和/或严重性将日志拆分为单独的文件,并设置 stop 选项,可以根据需要将基于严重性的消息输出到任意数量的文件。
示例(在rsyslog.conf 文件中设置):
*.*;auth,authpriv,kern.none /var/log/syslog
kern.* /var/log/kern.log
kern.debug stop
*.=debug;\
auth,authpriv.none;\
news.none;mail.none /var/log/debug
此配置:
kern 设施消息输出到syslog(由于kern.none)kern 的所有调试级别日志输出到kern.log 并在此处“停止”.none未排除的任何其他调试日志输出到debug
如何分开取决于您,但我建议您查看我包含的第一个链接。您可能还想查看different local facilities that can be used as separate log pipelines。
【讨论】: