rsyslogd:暂停操作“action-3-builtin:omfwd”

问题描述 投票:0回答:1

我想将mongodb日志发送到一个graylog服务器,相关的rsyslog配置如下:

$InputFileName /var/log/mongodb/mongod_27017.log
$InputFileTag mongodb
$InputFileStateFile mongodb-state
$InputFileFacility local3
$ActionSendTCPRebindInterval 10000
$InputRunFileMonitor
template(name="TAPSI_JSONFmt" type="string" string="{\"message\":\"%msg:::json%\",\"source\":\"%HOSTNAME:::json%\",\"timestamp\":\"%timegenerated:::date-rfc3339%\"}")
:msg, contains, "Slow query" {
        local3.* action(type="omfwd" template="TAPSI_JSONFmt" target="graylog.tapsi.tech" port="12205" protocol="tcp" action.resumeRetryCount="100" queue.type="linkedList" queue.size="100")
}

和rsyslog.conf如下:

# /etc/rsyslog.conf configuration file for rsyslog
#
# For more information install rsyslog-doc and see
# /usr/share/doc/rsyslog-doc/html/configuration/index.html
#
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf


#################
#### MODULES ####
#################

module(load="imuxsock") # provides support for local system logging
#module(load="immark")  # provides --MARK-- message capability

# provides UDP syslog reception
#module(load="imudp")
#input(type="imudp" port="514")

# provides TCP syslog reception
#module(load="imtcp")
#input(type="imtcp" port="514")

# provides kernel logging support and enable non-kernel klog messages
module(load="imklog" permitnonkernelfacility="on")

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

#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# Filter duplicated messages
$RepeatedMsgReduction on

#
# Set the default permissions for all log files.
#
$FileOwner syslog
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$PrivDropToUser syslog
$PrivDropToGroup syslog

#
# Where to place spool and state files
#
$WorkDirectory /var/spool/rsyslog

#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf

现在我遇到了一个麻烦,mongodb 日志没有发送到 graylog 服务器,我得到这个错误:

Jun 01 15:57:15 Asia-DB-Mongo-Chilli-Able rsyslogd[50679]: cannot connect to graylog.tapsi.tech:12205: Connection timed out [v8.2001.0 try https://www.rsyslog.com/e/2027 ]
Jun 01 15:57:15 Asia-DB-Mongo-Chilli-Able rsyslogd[50679]: action 'action-3-builtin:omfwd' suspended (module 'builtin:omfwd'), retry 0. There should be messages before this one giving the reason for suspension. [v8.2001.0 try https://www.rsyslog.com/e/2007 ]

我不知道到底是什么问题,我该如何解决这个问题。

linux logging syslog rsyslog graylog
1个回答
0
投票

取消注释这些行:

$ModLoad imtcp.so
$InputTCPServerRun 514
注意:如果这两行不存在,则在第 32 行附近添加

在此之后执行以下步骤: 步骤 1)

systemctl restart rsyslog.service
步骤 2)
firewall-cmd --permanent --port=514/tcp
步骤 3)
firewall-cmd --reload-all
在克林特系统运行
echo "*.* @@192.x.x.x:514 >> /etc/rsyslog.conf
然后
systemctl restart rsyslog.service
注意:这里的 192.x.x.x 是您的 rsyslog 服务器 IP 地址,您也应该可以访问(能够 ping 通)该服务器

希望这对你有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.