cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1392
Views
0
Helpful
1
Replies

EEM Create variable from syslog pattern NXOS

hegleran
Level 1
Level 1

I've been reading through a number of posts and I think what I'm trying to do can't be done natively within EEM but I wanted to confirm. I am trying to match a syslog pattern, and then create a variable from a portion of the syslog pattern that I can take action on further within the applet. Such as:

event manager applet bounce

 event syslog pattern "port Ethernet1/15 is operationally individual"

  action 1 cli sleep 10

  action 2 cli conf

  action 3 cli int Ethernet1/15

  action 4 cli shut

  action 5 cli no shut

  action 6 syslog priority alerts msg "bounce workaround for Ethernet1/15 implemented"

Is there a way to parse the Ethernet1/15 expression as Ethernet.\/* and assign it as a variable such as $interface that can later be referenced in the actions that follow? If not, then could just this expression within the entire syslog pattern be sent to a python script, or would I have to do all of the parsing of the syslog pattern from within python?

Thanks in advance.

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

It looks like you're running NX-OS < 7.0.  In this case, you cannot perform any logic within EEM applets.  What you can do is execute a Python script and pass the syslog message to it with the $_syslog_msg variable.  Within that Python script, you can parse the syslog message, and then execute your desired CLI.