cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1242
Views
10
Helpful
4
Replies

Program with EEM to receive a log on my TFTP always a Router Reboots

Inomatl
Level 1
Level 1

Hi Gents,

I am new on automation and would like to know how can instruct a Router to send logs to my TFTP server always it reboots.

 

Thanks in advance

1 Accepted Solution

Accepted Solutions

Hello,

 

if you want to send the logs to a TFTP server, you need to save them to your flash first. From there you can send them to your TFTP server upon reboot. The config would look like below. In the example, your debug logs are saved to flash. 100MB of flash is allocated, and the maximum size per log is 5MB. You can obviously adjust these values.

 

You can either use cron, or match on syslog, so both scripts effectively do the same thing.

 

Router(config)#logging buffer 20000000 debugging
Router(config)#logging persistent url flash0:/DEBUG_LOGS size 104857600 filesize 5242880
!
event manager applet REBOOT_OCCUR
event syslog pattern "SYS-5-RESTART"
event timer countdown time 30
action 1.0 cli command "enable"
action 2.0 cli command "copy flash0:/DEBUG_LOGS/log* tftp://<tftp_server_ip_address>/
!
event manager applet REBOOT_OCCUR
event timer cron cron-entry "@reboot"
event timer countdown time 30
action 1.0 cli command "enable"
action 2.0 cli command "copy flash0:/DEBUG_LOGS/log* tftp://<tftp_server_ip_address>/

View solution in original post

4 Replies 4

balaji.bandi
Hall of Fame
Hall of Fame

Why not setup a syslog to send logs all the time to syslog server. when the router reboot all the logs will be wiped.

 

or you looking bootup logs ?

 

configure logging :

 

https://community.cisco.com/t5/networking-documents/how-to-configure-logging-in-cisco-ios/ta-p/3132434

 

BB

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

How to Ask The Cisco Community for Help

Hi BB,

 

Thanks for your input,

 

as wrote early i am new on this and figured out that the best thing to do is to setup a pattern (saying that the Router suffered a reboot) always it reboots, I don't know if I can work on it based on any startup pattern once it comes up or maybe use a loopback interface as I am sure that when the device comes up it will be up. Any better idea?

 

But definitely I will have to set this to send the notification by mail when a pattern match.

Hello,

 

if you want to send the logs to a TFTP server, you need to save them to your flash first. From there you can send them to your TFTP server upon reboot. The config would look like below. In the example, your debug logs are saved to flash. 100MB of flash is allocated, and the maximum size per log is 5MB. You can obviously adjust these values.

 

You can either use cron, or match on syslog, so both scripts effectively do the same thing.

 

Router(config)#logging buffer 20000000 debugging
Router(config)#logging persistent url flash0:/DEBUG_LOGS size 104857600 filesize 5242880
!
event manager applet REBOOT_OCCUR
event syslog pattern "SYS-5-RESTART"
event timer countdown time 30
action 1.0 cli command "enable"
action 2.0 cli command "copy flash0:/DEBUG_LOGS/log* tftp://<tftp_server_ip_address>/
!
event manager applet REBOOT_OCCUR
event timer cron cron-entry "@reboot"
event timer countdown time 30
action 1.0 cli command "enable"
action 2.0 cli command "copy flash0:/DEBUG_LOGS/log* tftp://<tftp_server_ip_address>/

Hi GP

Sure this work, thanks.

But I think that I will have to setup a mail server so it can send me an e-mail always the RT suffers a reboot, got to figure out a patter that will help me to accomplish this. 

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: