2

我有如下配置 snmptrapd.conf

disableAuthorization yes
authCommunity log,execute,net public

我想重定向其他文件的所有消息,例如。/var/log/snmp.log,不适用于/var/log/messages。我还尝试重新配置rsyslog.conf文件:

snmp.*                                              /var/log/snmp.log

但我有这样的错误

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

我的问题是,如何使用rsyslog.confsnmptrapd.conf将所有 SNMP 陷阱重定向到其他文件

我知道,我可以使用如下命令手动保存输出,但我需要将守护进程作为服务工作,而不是来自 bash shell 的单个命令。

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

2 回答 2

0

尝试这个:

# 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: ""
于 2020-10-28T08:12:08.780 回答
0

您可以将 -t 选项与 snmptrapd 一起使用。

snmptrapd -tLf /your-log-location/yourlogfile.log --disableAutherization=yes
于 2019-12-24T10:59:16.477 回答