SNMP TRAPS sending to other file, than /var/log/messages

10.4k Views Asked by At

I have configuration snmptrapd.conf like below:

disableAuthorization yes
authCommunity log,execute,net public

I wanted to redirect all messages for other file, ex. /var/log/snmp.log, not for /var/log/messages. I tried also reconfigure rsyslog.conf file:

snmp.*                                              /var/log/snmp.log

but I have error like that

sie 17 12:50:47 snmp rsyslogd[20398]: unknown facility name "snmp" [v8.24.0]

My question is, how to redirect all SNMP traps to other file by using rsyslog.conf or snmptrapd.conf

I know, that I can save output manually by using command like below, but I need working deamon as a service, not a single command from bash shell.

snmptrapd -f -Le -A -Lf /var/log/snmptrapd.log
2

There are 2 best solutions below

0
On

You can use -t option with snmptrapd.

snmptrapd -tLf /your-log-location/yourlogfile.log --disableAutherization=yes
0
On

Try this:

# LOGFILE="path to logfile"
#   specify the pathname of the logfile; if none or the empty string "" is
#   given, use the syslog() mechanism to log the traps
#   Default: ""