I am trying to forward MongoDB logs from several remote servers to a central logging server. To do this, I changed my mongod.conf
files to use syslog like so:
systemLog:
destination: syslog
syslogFacility: local3
I then configured rsyslog to forward messages like so:
if($syslogFacility-text == "local3") then{
if($syslogTag contains "mongod") then{
action(type="omfwd" target="MY.SYSLOG.SERVER.IP" port="PORT" protocol="udp")
stop
}
}
My logging server is configured to write any messages sent at that port to my central mongod.log
file.
My question is; is there a better way to do this? For example, could I specify my logging server's IP/PORT in mongod.conf
so I don't have to rely on each Mongo server's local rsyslog?