Monday, July 11, 2011

Top Ten Cisco IOS Commands - 5) sh archive log config all

This will be one of your favorites if you ever have to use it to roll back changes to a Cisco router or switch.

First, setup the configuration change logging:

R1# config term

Enter archive config mode:
R1(config)# archive

Enter logger config mode:
R1(config-archive)# log config

Enable logging of config changes:
R1(config-archive-log-config)# logging enable

Set the max number of entries to retain in the log:
R1(config-archive-log-config)# logging size 500

Suppress displaying passwords in the log file:
R1(config-archive-log-config)# hidekeys

Enable sending config changes to a syslog server:
R1(config-archive-log-config)# notify syslog

In order to view the log entries:
R1# sh archive log config all
  ...
  ...
  387    28   unknown user@vty0     |ip access-list standard GoodIP
  388    28   unknown user@vty0     | remark Internal Servers
  389    28   unknown user@vty0     | permit 10.22.65.10
  390    28   unknown user@vty0     | permit 10.22.22.10
  391    28   unknown user@vty0     | permit 10.24.97.10
  392    28   unknown user@vty0     | permit 10.25.17.10
  393     0    unknown user@vty2     |!exec: enable
  394     0    unknown user@vty0     |!exec: enable
  395    31   unknown user@vty0     |interface Tunnel200
  396    31   unknown user@vty0     | shutdown
  ...
  ...

That's pretty useful if you need to know the last command(s) you or someonelse issued on the device. But, for larger entries or pastes wouldn't it be great if you could see that same data in a format ready to copy into a text editor? Try this...

sh archive log config all provisioning

No comments:

Post a Comment