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

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Logs showing Mar 1 for entries even though sho clock shows todays date?

Hi,

 

I have a 3750X stack I just put together. Some of the switches have been shelved for a couple of years so I think the battery might be going/gone on it. In the meantime I would just like to be able to have the logs timestamped with the correct time/ date. Is this possible?

See below

MTL-CORE3750XFL12-1#show log

.....

*Mar  1 00:06:50 UTC: %SYS-5-CONFIG_I: Configured from console by vty0 (172.16.1.131)

MTL-CORE3750XFL12-1#  show clock

14:16:50.375 UTC Thu Aug 28 2014

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

If a router is configured to

If a router is configured to get the time from a Network Time Protocol (NTP) server, the times in the router's log entries may be different from the time on the system clock if the [localtime] option is not in the service timestamps log command. In the example below, the router gets its time from an NTP server and theservice timestamps log datetime command is issued. The show clock command displays a time of 14:12:26, yet when a configuration change is made immediately after the show clock command, the log message shows a time of21:12:28, as shown in this example:

 

clock timezone PST -8
clock summer-time PDT recurring
service timestamps debug datetime
service timestamps log datetime
logging buffered 16000 debugging
ntp clock-period 17179272
ntp server 161.181.92.152

router#show clock
14:12:26.312 PDT Thu Apr 27 2000
router#config t
Enter configuration commands, one per line. End with CNTL/Z.
router(config)#exit
router#
Apr 27 21:12:28: %SYS-5-CONFIG_I: Configured from console by vty0

 

Resolution

Add the [localtime] option to the service timestamps log command. For example, if the current configuration isservice timestamps log datetime, issue this global configuration command:

router(config)#service timestamps log datetime localtime
router(config)#^Z (ctrl z to exit)
router#write mem

 

The times should now be synchronized between the system clock and the log message timestamps.

 

HTH

Regards

Inayath

*Plz rate all usefull posts.

1 REPLY
Cisco Employee

If a router is configured to

If a router is configured to get the time from a Network Time Protocol (NTP) server, the times in the router's log entries may be different from the time on the system clock if the [localtime] option is not in the service timestamps log command. In the example below, the router gets its time from an NTP server and theservice timestamps log datetime command is issued. The show clock command displays a time of 14:12:26, yet when a configuration change is made immediately after the show clock command, the log message shows a time of21:12:28, as shown in this example:

 

clock timezone PST -8
clock summer-time PDT recurring
service timestamps debug datetime
service timestamps log datetime
logging buffered 16000 debugging
ntp clock-period 17179272
ntp server 161.181.92.152

router#show clock
14:12:26.312 PDT Thu Apr 27 2000
router#config t
Enter configuration commands, one per line. End with CNTL/Z.
router(config)#exit
router#
Apr 27 21:12:28: %SYS-5-CONFIG_I: Configured from console by vty0

 

Resolution

Add the [localtime] option to the service timestamps log command. For example, if the current configuration isservice timestamps log datetime, issue this global configuration command:

router(config)#service timestamps log datetime localtime
router(config)#^Z (ctrl z to exit)
router#write mem

 

The times should now be synchronized between the system clock and the log message timestamps.

 

HTH

Regards

Inayath

*Plz rate all usefull posts.

27
Views
5
Helpful
1
Replies