Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 

EEM script to save logs in a file every 30 mins

EEM script to save logs in a file every 30 mins

Problem:

The router is having an issue where we are unable to login to the router using console or mgmt ports. Other components of router is working fine. RSP reload is the only way we can get access to the router.

Since the access to router is disabled we cannot login to the router in order to collect the logs to debug this issue further.

Solution:

We can use EEM script inorder to collect the logs and save it into a file in harddisk. This EEM script will run every 30 mins and dump the logs into the file. The cron entry can be changed incase we want to run it once every day or some other period.

Logs that the script collects:

show proc devc-vty
show proc devc-conaux
show log
sh processes cpu
Show users
Show line

Router's config:

event manager environment _cron_entry 30,0 * * * 0-6    <<<<< runs script every 30 mins

event manager directory user policy harddisk:/scripts/

event manager policy script_err_dis_v2_1.tcl username event_manager_user

persist-time 3600

username event_manager_user

group root-system

group cisco-support

!

aaa authorization commands eem-method none

aaa authorization eventmanager default local

vty-pool eem 100 105 line-template eem-template

  line template eem-template

authorization commands eem-method

More Scripts: EEM Script Repository

704
Views
0
Helpful
0
Comments