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

EEM script for show log comman

ben.young.ctr
Level 1
Level 1

I am trying to create a script to scp the output of the show log command to a server, while we're waiting on our Syslog server.  Any help would be appreciated.

1 Reply 1

balaji.bandi
Hall of Fame
Hall of Fame

here is the Option we see (i do not see option of SCP) - cehck your code support, tested with TFTP works for me

 

show logging | redirect ?
bootflash: Uniform Resource Locator
crashinfo-1: Uniform Resource Locator
crashinfo-2: Uniform Resource Locator
crashinfo-3: Uniform Resource Locator
crashinfo-4: Uniform Resource Locator
crashinfo: Uniform Resource Locator
flash-1: Uniform Resource Locator
flash-2: Uniform Resource Locator
flash-3: Uniform Resource Locator
flash-4: Uniform Resource Locator
flash: Uniform Resource Locator
ftp: Uniform Resource Locator
http: Uniform Resource Locator
https: Uniform Resource Locator
nvram: Uniform Resource Locator
stby-crashinfo: Uniform Resource Locator
stby-flash: Uniform Resource Locator
stby-nvram: Uniform Resource Locator
stby-rcsf: Uniform Resource Locator
tftp: Uniform Resource Locator

 

here is EEM Script tested :

event manager applet MyLog authorization bypass
event none
action 1.0 cli command "enable"
action 2.0 info type routername
action 3.0 cli command "show clock"
action 3.1 regexp "(2[0-3]|[01][0-9]):([0-6][0-9]):([0-6][0-9])" "$_cli_result" time hour minute second
action 3.6 cli command "show clock"
action 3.7 regexp "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([1-9]|0[1-9]|[1-2][0-9]|3[0-1]) (20[1-9][0-9])" "$_cli_result" time2 month day year
action 4.0 cli command "show logging | redirect tftp://x.x.x.x/$_info_routername-$year$month$day-$hour$minute$second.log"
action 6.0 syslog priority informational msg "Configuration change detected. Write to TFTP succesfully executed"

 

if you want to run certail times add below timer count down then show logg will be redirect to tftp.

event timer watchdog time 300

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Review Cisco Networking for a $25 gift card