01-10-2022 10:21 PM
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
Solved! Go to Solution.
01-11-2022 04:06 AM
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>/
01-11-2022 01:49 AM
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 :
01-11-2022 10:37 PM
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.
01-11-2022 04:06 AM
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>/
01-11-2022 10:45 PM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide