1

I want to send MongoDB logs to a Graylog server, and the related rsyslog configuration is as follows:

$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")
}

and rsyslog.conf is as follows:

# /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

Now I have trouble that MongoDB logs are not sent to the Graylog server and I get this error:

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 ]

I don't know what the problem is exactly and how can I fix this issue.

0

You must log in to answer this question.

Browse other questions tagged .