rsyslog - 將 omfwd 與 TCP 相比與 UDP 結合使用時的吞吐量較低

rsyslog - 將 omfwd 與 TCP 相比與 UDP 結合使用時的吞吐量較低

太長了;

轉發系統日誌訊息時,我的吞吐量顯著降低系統日誌在具有 32 個核心和 128Gi RAM 的 Redhat 伺服器上使用 TCP 而不是 UDP syslog 到遠端伺服器奧姆弗德行動。

如何使用 TCP 轉送訊息,同時跟上入站訊息量?

註 1:pps = 每秒資料包數

註 2:注意 Rx 與 Tx 統計的差異

當使用 UDP 轉發傳入訊息時:

[~]$ ./check_network_stats.bash eth0
Rx    10088 pps Tx    10092 pps |--| Rx    7 Mbps Tx    7 Mbps
Rx    11858 pps Tx    11857 pps |--| Rx    8 Mbps Tx    8 Mbps
Rx    11503 pps Tx    11502 pps |--| Rx    8 Mbps Tx    8 Mbps
Rx    11423 pps Tx    11321 pps |--| Rx    8 Mbps Tx    8 Mbps

當使用 TCP 轉送傳入訊息時:

[~]$ source check_network_stats.bash eth0
Rx    10318 pps Tx       87 pps |--| Rx    7 Mbps Tx    0 Mbps
Rx    12150 pps Tx      162 pps |--| Rx    8 Mbps Tx    0 Mbps
Rx     9504 pps Tx      139 pps |--| Rx    7 Mbps Tx    0 Mbps
Rx     9774 pps Tx       67 pps |--| Rx    6 Mbps Tx    0 Mbps
Rx    12894 pps Tx      159 pps |--| Rx    9 Mbps Tx    0 Mbps

rsyslog.conf:

# rsyslog configuration file


#################
#### MODULES ####
#################
         
module(load="imjournal" StateFile="imjournal.state")
module(load="imklog") # reads kernel messages (the same are read from journald)
module(load="immark" interval="300") # provides --MARK-- message capability
module(load="imudp" threads="4" batchSize ="128") # Provides UDP syslog reception
module(load="imptcp" threads="10") # Provides TCP syslog reception
module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat") # Use default timestamp format

###############
#### RULES ####
###############

ruleset(name="sendToLogstash") {
    action(type="omfwd"
       name="action_ls"
       Target="10.10.10.10"
       Port="514"
       Protocol="udp" # when this changed to TCP, throughput drops
       queue.type="FixedArray"
       )
}

###########################
#### LISTENERS         ####
###########################
input(type="imudp" port="514" ruleset="sendToLogstash")
input(type="imptcp" port="514" ruleset="sendToLogstash")

###########################
#### GLOBAL DIRECTIVES ####
###########################

mark.*  /var/log/messages

# Where to place auxiliary files
global(workDirectory="/var/lib/rsyslog")

相關內容