我正在运行一个繁忙的 DNS 服务器,它通过 rsyslog 将查询记录到远程服务器。
由于我们正在处理的流量很大,我不得不增加 rsyslog.conf 中的速率限制。该服务器每秒处理约 1.2K DNS 请求的峰值,这意味着到远程记录器的传出流量约为 2Mbps。
但是,当使用$AddUnixListenSocket /var/named/chroot/dev/log
rsyslog 指令时,我发现发送到远程服务器的数据急剧减少。如果没有这个指令,一切都很好,除了在 rsyslog 重新启动后日志记录停止,还需要重新启动 BIND 之外。
似乎添加$AddUnixListenSocket
“打破”了 rsyslog 中的速率限制增加。这里发生了什么?
软件版本: - CentOS 6.7 x86_64 - rsyslog-5.8.10-10.el6_6.x86_64 - bind-9.8.2-0.37.rc1.el6_7.2.x86_64
我的/etc/rsyslog.conf
:
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$SystemLogRateLimitInterval 10
$SystemLogRateLimitBurst 15000
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
*.info;mail.none;authpriv.none;cron.none /var/log/messages
authpriv.* /var/log/secure
mail.* -/var/log/maillog
cron.* /var/log/cron
*.emerg *
uucp,news.crit /var/log/spooler
local7.* /var/log/boot.log
和/etc/rsyslog.d/fwd.conf
:
# keep logging after rsyslog restart
$AddUnixListenSocket /var/named/chroot/dev/log
# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
$WorkDirectory /var/lib/rsyslog # where to place spool files
$ActionQueueFileName tso_fwd # unique name prefix for spool files
$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
$ActionQueueMaxFileSize 100M # AF: limit open file descriptors
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
$ActionQueueType LinkedList # run asynchronously
$ActionQueueTimeoutEnqueue 0 # AF: discard when queue is full
$ActionResumeRetryCount -1 # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
#*.* @@remote-host:514
local0.* @@1.1.1.1:514
& ~
# ### end of the forwarding rule ###
答案1
嗯,看来确实是忽略了限速设置。
当我添加时,$AddUnixListenSocket
输入已更改为imuxsock
模块,该模块有自己的速率限制设置。
顶部/etc/rsyslog.d/fwd.conf
看起来像:
# raise logging limits
$IMUXSockRateLimitInterval 10
$IMUXSockRateLimitBurst 15000
# keep logging after rsyslog restart
$AddUnixListenSocket /var/named/chroot/dev/log
这解决了这个问题。