我正在尝试将这3个命令执行到rsyslog中:
IFS=':' read -a trap <<< "${msg}"
IFS='#' read -a trap2 <<< "${trap[11]}"
if $trap2 > 300 then ^/pruebas/script.sh
但是当我重新启动rsyslog时,我遇到了这样的错误:
Aug 11 13:05:49 sSAI kernel: imklog 5.8.11, log source = /proc/kmsg started.
Aug 11 13:05:49 sSAI rsyslogd: [origin software="rsyslogd" swVersion="5.8.11" x-pid="12495" x-info="http://www.rsyslog.com"] start
Aug 11 13:05:49 sSAI rsyslogd-3000: unknown priority name "" [try http://www.rsyslog.com/e/3000 ]
Aug 11 13:05:49 sSAI rsyslogd: the last error occured in /etc/rsyslog.conf, line 22:" IFS=':' read -a trap <<< "${msg}""
Aug 11 13:05:49 sSAI rsyslogd: warning: selector line without actions will be discarded
Aug 11 13:05:49 sSAI rsyslogd-3000: unknown priority name "" [try http://www.rsyslog.com/e/3000 ]
Aug 11 13:05:49 sSAI rsyslogd: the last error occured in /etc/rsyslog.conf, line 24:" IFS='#' read -a trap2 <<< "${trap[11]}""
Aug 11 13:05:49 sSAI rsyslogd: warning: selector line without actions will be discarded
Aug 11 13:05:49 sSAI rsyslogd-2124: CONFIG ERROR: could not interpret master config file '/etc/rsyslog.conf'. [try rsyslog... ]
我收到了与我在rsyslog中输入的每个不同代码相同的消息。
我的目标是识别snmp陷阱的一部分。我正在接收陷阱并提取该值,当该值大于300时,执行shell脚本。
有什么想法吗?感谢。