Bind

使用 $AddUnixListenSocket 時,rsyslog 向遠端發送數據會變慢?

  • October 22, 2015

我正在執行一個繁忙的 DNS 伺服器,它通過 rsyslog 將查詢記錄到遠端伺服器。

由於我們正在處理的流量很大,我不得不增加 rsyslog.conf 中的速率限制。該伺服器以每秒約 1.2K DNS 請求的峰值處理,轉換為遠端記錄器的約 2Mbps 傳出流量。

但是,當使用$AddUnixListenSocket /var/named/chroot/dev/logrsyslog 指令時,我發現發送到遠端伺服器的數據急劇減少。如果沒有這個指令,一切都很好,除了在 r​​syslog 重新啟動後日誌記錄停止,還需要重新啟動 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 ###

好吧,看來它確實忽略了限速設置。

當我添加時$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

這解決了這個問題。

引用自:https://unix.stackexchange.com/questions/237703