Cisco IOS archive feature path variables

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
 log config
  logging enable
 path tftp://$h-$t

Saving the configuration will trigger the archive process which will attempt to save the configuration file on the TFTP server, 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

 --cut for brevity--
 path tftp://

You can imagine how messy my backup files directory was  😆 Oh yeah. Every day is a lesson.

Hope this helps you.

1 thought on “Cisco IOS archive feature path variables

  1. Edson Ferreira

    Hello! What a great article!
    Straught to the point and very clear!

    I would include this parameter:

    config-archive)#time-period 1440

    Where 1440 is a parameter in minutes which means 24 hours, so, daily backup scheduled 😉

    Thank you a lot 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.