Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 

Log messages do not show the date and time, but instead show the length of time the router has been up

Core Issue

Log message timestamps may be configured to display either the date and time or  the router's uptime. If configured for uptime, the log  output is similar to this:

1d23h: %PARSER-3-BADSUBCMD: Unrecognized

subcommand 0 in interface command 'media-type'

The 1d23h: in this example indicates the router has been up  for 1 day and 23 hours.

If the log timestamps are configured for datetime, the  log output is similar to the following:

Jun 10 06:49:52: %LINK-3-UPDOWN: Interface Ethernet13/0/0, changed

state to up

This output indicates the date and time the error occurred.

Resolution

If the log messages on the router display the amount of time the router has been up instead of the date and time of the error, this can be changed by issuing the service timestamps global configuration command. The command syntax is similar to one of these examples:

  • service timestamps message-type [uptime]  
  • service timestamps message-type datetime [msec] [localtime] [show-timezone]

The type can be either debug or log. Debug is for the timestamp, while debugging and log are for the timestamp on regular log messages.

For example, to configure timestamps for logging to display the date and time as well as the time zone, the command is this:

router(config)#service timestamps log datetime show-timezone

To configure debug log messages to display the uptime only, the command is this:

router(config)#service timestamps debug uptime

To verify the current timestamp configuration on the router, issue the show run command. The service timestamps command is near the beginning of the command output as shown in this example:

router#show run

Building configuration...

Current configuration : 2057 bytes

!

version 12.1

no service single-slot-reload-enable

service timestamps debug datetime msec   

!--- Affects timestamps when running a debug.

service timestamps log datetime msec localtime show-timezone  

!--- Affects timestamps in the logs.

no service password-encryption

26641
Views
5
Helpful
0
Comments