【问题标题】:rsyslog - Lower throughput when using omfwd with TCP vs UDPrsyslog - 使用带有 TCP 与 UDP 的 omfwd 时吞吐量较低
【发布时间】:2022-01-06 21:08:52
【问题描述】:

TLDR;

在具有 32 个内核和 128Gi RAM 的 Redhat 服务器上使用 rsyslog 将 syslog 消息转发到在 omfwd 动作。

如何使用 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")

【问题讨论】:

    标签: networking tcp udp rsyslog rainerscript


    【解决方案1】:

    配置看起来不错。 您可能想尝试以下选项:

    action.resumeRetryCount 整数

    [默认0,-1表示永恒]

    设置一个动作在被认为有之前重试的频率 失败的。失败的操作会丢弃消息。

    你可以这样使用:

    action(type="omfwd" ... queue.resumeRetryCount="-1")
    

    这是我唯一想到的事情。否则,您可以使用 impstats 模块对其进行调试,并更好地了解 rsyslog 中实际发生的情况。

    module(load="impstats" file="/var/log/pstats" interval="60" 
        resetCounters="on" format="legacy")
    

    如果您这样做,我强烈建议您阅读 David Lang 撰写的关于 rsyslog 性能问题的 documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-22
      • 2019-01-30
      • 2016-08-05
      • 2016-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多