There’s something you might like.
Cisco IOS archive feature supports two variables that can be used to define path property. Those are $t for date/time and $h for hostname. Date/time format can be adjusted with service timestamps log command. Also, don’t forget to configure an appropriate timezone name and offset. Here’s an example.
service timestamps log datetime localtime show-timezone year ! clock timezone EET 2 clock summer-time EEST recurring last Sun Mar 3:00 last Sun Oct 4:00 ! archive log config logging enable hidekeys path tftp://10.0.0.1/Configs/$h-$t write-memory
Saving the configuration will trigger the archive process which will attempt to save the configuration file on the TFTP server 10.0.0.1, using the “HOSTNAME-MMM–D-HH:MM:SS-TMZ-N” naming template, where
- HOSTNAME – Configured hostname;
- MMM – Month, three letters abbreviation;
- D – Date, without leading zero;
- HH:MM:SS – Time;
- TMZ – Active timezone’s name (defined with clock timezone and clock summer-time commands);
- N – Archived config sequence number (from 0 to 9);
For example, it can be NETSW01-Jan–3-18:36:12-EET-1. You can play with date/time format – include/exclude year, milliseconds, timezone name – if you want, using previously mentioned service timestamps command.
I didn’t know about this neat variables until yesterday. Well, we don’t use Cisco IOS archive feature to backup network devices configuration in our company. Instead, we rely on SNMP-based software to do the work and I believe the majority of big companies do same way nowadays. But, I recently began to use it to backup configs within my friend’s network which lacks Enterprise-class management software to do the trick. Before today, my configs looked like this
archive --cut for brevity-- path tftp://10.0.0.1/Configs/NETSW01-Config- write-memory
You can imagine how messy my backup files directory was 😆 Oh yeah. Every day is a lesson.
Hope this helps you.