SNMP TRAPS 发送到其他文件,而不是 /var/log/messages

问题描述 投票:0回答: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
syslog net-snmp rsyslog snmp-trap snmptrapd
2个回答
0
投票

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

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

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: ""
© www.soinside.com 2019 - 2024. All rights reserved.