12-13-2020 08:05 PM
Hi all.
I have a Nexus 9300 and Catalyst 9500. I am trying to send entries of log to a FTP Server daily. Can you help me to accomplish this? Thank you.
Best regards,
12-14-2020 12:12 AM
- Why don't you just use a syslog server to collect and archive logs ?
M.
12-14-2020 12:56 AM
best is syslog, so you have all the logs in real time.
12-14-2020 01:59 AM - edited 12-14-2020 02:04 AM
Hello,
the EEM script below would send the entire content of the log file to an FTP server daily at midnight, and create a file on the FTP server with the device name followed by a timestamp. It also clears the log and sends a syslog message indicating that the file was written to the FTP server successfully.
Not sure if the syntax is the same on NX-OS...
event manager environment _event_pub_sec
event manager applet LOG_TO_FTP
description Log content to FTP server
event timer cron cron-entry "0 0 * * *" maxrun 9999999
action 1.0 info type routername
action 2.0 cli command "enable"
action 3.0 cli command "show log | append ftp://ftp-server/$_info_routername-log_$_event_pub_sec"
action 4.0 cli command "clear log" pattern "confirm"
action 5.0 cli command "y"
action 6.0 syslog priority informational msg "Log content successfully written to FTP server"
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