04-18-2013 06:46 AM
Hi all,
I'm trying to collect the last syslog message that triggered a script to run as shown below:
::cisco::eem::event_register_syslog pattern "%LINEPROTO-5-UPDOWN:" maxrun 120
# NAMESPACE IMPORT
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
array set syslog_info [event_reqinfo]
set message $syslog_info(msg)
action_syslog msg "----------> $message"
But every single time the variable is empty despite the fact the script was triggered.
Output
*Apr 18 13:20:23.511: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
*Apr 18 13:20:24.019: %HA_EM-6-LOG: duplex-snmp.tcl: ---------->
*Apr 18 13:20:23.511: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
Any idea why ?
Thanks
Sotiris
Solved! Go to Solution.
04-18-2013 06:51 AM
It's not empty. The syslog message starts with a newline, so the line right below ---> is the syslog message stored in the $message variable. If you want to prove that, do:
action_syslog msg "----------> [string trim $message]"
04-18-2013 06:51 AM
It's not empty. The syslog message starts with a newline, so the line right below ---> is the syslog message stored in the $message variable. If you want to prove that, do:
action_syslog msg "----------> [string trim $message]"
04-18-2013 07:17 AM
Thanks Joseph.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide