cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2024
Views
5
Helpful
6
Replies

EEM Script for Syslog

tpahuja
Level 1
Level 1

Folks,

           Can someone share with me a sample EEM script that stores all the syslog messages to the flash of the router.

1 Accepted Solution

Accepted Solutions

Hello,

 

you don't need an EEM script to accomplish this. Just configure the below (the exact syntax depends on the flash device(s) you have, size also depends on how big your logs are):

 

Router#conf t
Router(config)#logging buffered 16384 7
Router(config)#logging persistent url flash0:/syslog size 16384 filesize 16384

 

If you need to have this in an EEM script, the below sample would execute the script every day at midnight:

 

event manager applet SYSLOG_TO_FLASH
event timer cron cron-entry "0 0 * * *" maxrun 9999999
action 1.0 cli command "enable"
action 2.0 cli command "conf t"
action 3.0 cli command "logging buffered 16384 7"
action 4.0 cli command "logging persistent url flash0:/syslog size 16384 filesize 16384"
action 5.0 cli command "end"

View solution in original post

6 Replies 6

Hello,

 

you don't need an EEM script to accomplish this. Just configure the below (the exact syntax depends on the flash device(s) you have, size also depends on how big your logs are):

 

Router#conf t
Router(config)#logging buffered 16384 7
Router(config)#logging persistent url flash0:/syslog size 16384 filesize 16384

 

If you need to have this in an EEM script, the below sample would execute the script every day at midnight:

 

event manager applet SYSLOG_TO_FLASH
event timer cron cron-entry "0 0 * * *" maxrun 9999999
action 1.0 cli command "enable"
action 2.0 cli command "conf t"
action 3.0 cli command "logging buffered 16384 7"
action 4.0 cli command "logging persistent url flash0:/syslog size 16384 filesize 16384"
action 5.0 cli command "end"

Can I log locally to the switch in it's buffer and send messages to the syslog server at the same time?

Yes. Actually the sample script I posted does both at the same time...

Where do i specify the ip address of the syslog host?

Hello

 

in global configuration mode:

 

Router(config)#logging host ip-address

I am still not clear how this script will send syslog messages to a syslog server and also store them in the flash of a router/switch.

 

From your eem scrpt i can gather that you are scripting a router/switch to enable logging persistent and store the logs to the switch flash. where is the part in your script that says send the messages to a syslog server as well. please assist.