cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
149307
Views
171
Helpful
22
Comments
TCC_2
Level 10
Level 10

Core Issue:

Timestamps are useful for viewing when certain events happen on a router. Timestanps are also helpful for troubleshooting, because they allow the network administrator to compare simultaneous events on network routers and analyze whether one occurrence caused, or was a result of, another.

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 of 21: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 is service 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.

Comments
adonis.vargas
Community Member

Solution works out great.  thanks for the info.

devnetjmt
Level 1
Level 1

Great! Thank you very much

er.vinay85
Community Member

yes, it's working.

Jhon Grimaldo
Community Member

Perfect. Thanks for the information!

jc.bogard
Level 1
Level 1

Very nice, for your debugs to appear with the same time enter the following:

 

Router_VG(config)#service timestamps debug datetime localtime msec

adsanchezl
Community Member

Thanks!

allen mert
Level 1
Level 1

Just to add an additional info:

- to enable logging in sequence for debugs/logs in order to prevent confusion when packets are received almost at the same time:

(config)# service sequence-numbers

 

e.g.

Seq. Number

   1186182: Oct 28 14:42:53.834 UTC: RSTP(210): sending BPDU out Gi1/0/11
   1186183: Oct 28 14:42:53.834 UTC: RSTP(210): sending BPDU out Gi1/0/25
   1186184: Oct 28 14:42:53.834 UTC: RSTP(210): sending BPDU out Gi1/0/27
   1186185: Oct 28 14:42:53.834 UTC: RSTP(210): sending BPDU out Gi1/0/28

 

this helps  a lot for analyzing..

Allen

 

aineiasmatis
Community Member

Very helpful!! Thank you very much!!!

Muftau Raheem
Community Member

Thanks very relevant and saved my time.

Thanks it worked

miras
Level 5
Level 5

It works. Thank you!

Manivannan R
Level 1
Level 1

Thanks Bro its working

Samer R. Saleem
Level 4
Level 4

thanks a lot i had a problem with voice gateway logs time and now its good.

many thanks

SwathyEdayath
Level 1
Level 1

thank you . this has really helped

pablo.e.busto
Level 1
Level 1

Great info!!! Thanks!!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking for a $25 gift card