cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4177
Views
5
Helpful
20
Replies

EEM: Set variable from syslog message

stewart-smith
Level 1
Level 1

Hi all,

I was wondering if it is possible to put the output of a syslog message generated from a TCL script into variable and trim that to only get a subset of the syslog message.

I believe the logic would be like this but still trying to translate it to EEM:

set a (show log | incl % IVR)

set b (string a 4555)

# we only want 4555 from the syslog message

And then put b into a CLI command.

Is that possible? Or do I need to write to a file instead and parse the file for that message and put it into the variable?

Thank you in advance for any suggestions.

20 Replies 20

Hmmm... I must be missing something fundamental here...

I amended the tcl script to have the following:

run_cli [list "voice translation-rule 3" "rule 1 /00442071234567/ /$pnum/"]

I then a have the following config:

!

event manager directory user policy "flash:/"

event manager policy sl_ivr_runnerv2.tcl type user

!

And then I made a test call and I see that the syslog message generated by the original script is present BUT the syslog generated by your tcl script is not present so it looks like the script is not called.

Apologies if I am missing the obvious...

A few debugs showing that it doesn't go into configuration mode... guess I need to amend the script a little bit.

Will post again to let you know how I get on.

May 13 2009 23:24:26.473 BST: %HA_EM-6-LOG: sl_ivr_runnerv2.tcl : DEBUG(cli_lib) : OUT : Router#

May 13 2009 23:24:26.473 BST: [fh_cli_debug_cmd]

May 13 2009 23:24:26.473 BST: %HA_EM-6-LOG: sl_ivr_runnerv2.tcl : DEBUG(cli_lib) : IN : Router#voice translation-rule 3

May 13 2009 23:24:26.473 BST: [fh_tty_write_cmd]

May 13 2009 23:24:26.473 BST: [fh_tty_write_cmd] cmd = voice translation-rule 3, cmdsize = 24

May 13 2009 23:24:26.473 BST: [fh_sys_reqinfo_routername_cmd]

May 13 2009 23:24:26.489 BST: [fh_tty_read_cmd]

May 13 2009 23:24:26.489 BST: [fh_tty_read_cmd] size= 66

May 13 2009 23:24:26.489 BST: [fh_tty_prompt_cmd]

May 13 2009 23:24:26.593 BST: [fh_cli_debug_cmd]

May 13 2009 23:24:26.593 BST: %HA_EM-6-LOG: sl_ivr_runnerv2.tcl : DEBUG(cli_lib) : OUT : ^

May 13 2009 23:24:26.593 BST: %HA_EM-6-LOG: sl_ivr_runnerv2.tcl : DEBUG(cli_lib) : OUT : % Invalid input detected at '^' marker.

Yes, you need to adjust the run_cli line:

run_cli [list "config t" ...]

Finally! Fixed...

I needed to add an extra parameter to go into config mode:

run_cli [list "config t" "voice translation-rule 3" "rule 1 /00442081234567/ /$pnum/"]

Thank you.

Appreciate all the patience and help I have had from you. :)

Try registering this version. See if you get any output.

The original is working fine Jo. Thank you, I had to add the statement "config t" in the command list. :)

Thank you again. Could not have finished this POCL with you.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: