Enabling Error Log Counting
Problem
You wish to see the number and type of log messages created by the router.
Solution
Use the logging count command to enable error log counting:
Router2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router2(config)#logging count
Router2(config)#end
Router2#
Discussion
The logging count command causes the router to maintain a count and timestamp of each recorded log type. To view the results of the log counting, use the show logging count command:
Router2#show logging count
Facility Message Name Sev Occur Last Time
==================================================================================
NTP PEERREACH 6 3 Jul 13 20:31:34.441
NTP PEERSYNC 5 1 Jul 13 20:23:03.571
NTP PEERUNREACH 4 3 Jul 13 20:22:00.435
NTP RESTART 6 1 Jan 31 14:13:33.769
------------- ------------------------------- ----------------------------------
NTP TOTAL 8
SYS ESMSHUTDOWN 7 7 Jul 15 19:18:07.476
SYS PRIV_AUTH_PASS 5 7 Jul 15 19:32:50.735
SYS LOGGINGHOST_STARTSTOP 6 4 Jul 15 19:56:31.203
SYS RESTART 5 1 Jan 31 14:13:33.697
SYS CONFIG_I 5 23 Jul 15 20:11:14.943
SYS CLOCKUPDATE 6 4 Jul 13 20:21:59.574
------------- ------------------------------- ----------------------------------
SYS TOTAL 46
LINEPROTO UPDOWN 5 4 Jan 31 14:13:33.260
------------- ------------------------------- ----------------------------------
LINEPROTO TOTAL 4
LINK CHANGED 5 2 Jan 31 14:13:34.390
------------- ------------------------------- ----------------------------------
LINK TOTAL 2
CLEAR COUNTERS 5 4 Jul 15 20:09:00.005
------------- ------------------------------- ----------------------------------
CLEAR TOTAL 4
Router2#
Notice that the router displays a nice overview of error log messages that have occurred and a timestamp of the most recent occurrence. The router also groups log messages by type, keeping all NTP-related messages together, for instance.
On the highlighted output line, notice that the router's configuration has been modified 23 times since log counting was enabled. Also notice the last recorded message was July 15 at 20:11. Note that the "Sev" column indicates the log message's severity level.
Unfortunately, Cisco doesn't provide an easy way to clear these statistics. The only way to reset the logging count values is to reload the router