To configure the system to apply a time stamp to debugging messages or system logging messages, use the service timestamps command in global configuration mode. To disable this service, use the no form of this command.
service timestamps
[
debug
| log
]
[
uptime
| datetime
| msec
]
[
localtime
]
[
show-timezone
]
[
year
]
no service timestamps
[
debug
| log
]
Syntax Description
debug
|
(Optional) Indicates time-stamping for debugging messages.
|
log
|
(Optional) Indicates time-stamping for system logging messages.
|
uptime
|
(Optional) Specifies that the time stamp should consist of the time since the system was last rebooted. For example “4w6d”
(time since last reboot is 4 weeks and 6 days).
|
datetime
|
(Optional) Specifies that the time stamp should consist of the date and time.
-
The time-stamp format for datetime is MMM DD HH:MM:SS, where MMM is the month, DD is the date, HH is the hour (in 24-hour notation), MM is the minute, and SS
is the second.
-
If the datetime keyword is specified, you can optionally add the msec
localtime , show-timezone , or year keywords.
-
If the service
timestamps
datetime command is used without addtional keywords, time stamps will be shown using UTC, without the year, without milliseconds,
and without a time zone name.
|
msec
|
(Optional) Includes milliseconds in the time stamp, in the format HH:
DD:
MM:
SS.
mmm , where .mmm is milliseconds
|
localtime
|
(Optional) Time stamp relative to the local time zone.
|
year
|
(Optional) Include the year in the date-time format.
|
show-timezone
|
(Optional) Include the time zone name in the time stamp.
Note
|
If the localtime keyword option is not used (or if the local time zone has not been configured using the clock
timezone command), time will be displayed in Coordinated Universal Time (UTC).
|
|
Command Default
Time stamps are applied to debug and logging messages.
Command Modes
Global configuration (config)
Command History
Release
|
Modification
|
Cisco IOS XE Catalyst SD-WAN Release 17.3.1a
|
Command qualified for use in Cisco vManage CLI templates.
|
In the following example, the router begins with time-stamping disabled. Then, the default time-stamping is enabled (uptime
time stamps applied to debug output). Then, the default time-stamping for logging is enabled (uptime time stamps applied to
logging output).
Router# show running-config | include time
no service timestamps debug uptime
no service timestamps log uptime
Router# config terminal
Device(config)# service timestamps
! issue the show running-config command in config mode using do Router(config)# do show running-config | inc time
! shows that debug timestamping is enabled, log timestamping is disabled
service timestamps debug uptime
no service timestamps log uptime
! enable timestamps for logging messages
Router(config)# service timestamps log
Router(config)# do show run | inc time
service timestamps debug uptime
service timestamps log uptime
Router(config)# service sequence-numbers
Router(config)# end
000075: 5w0d: %SYS-5-CONFIG_I: Configured from console by console
! The following is a level 5 system logging message
! The leading number comes from the service sequence-numbers command.
! 4w6d indicates the timestamp of 4 weeks, 6 days 000075: 4w6d: %SYS-5-CONFIG_I: Configured from console by console
In the following example, the user enables time-stamping on logging messages using the current time and date in Coordinated
Universal Time/Greenwich Mean Time (UTC/GMT), and enables the year to be shown.
Router(config)# service timestamps log datetime show-timezone year
Router(config)# end
! The following line shows the timestamp with datetime (11:13 PM March 22nd)
.Mar 22 2004 23:13:25 UTC: %SYS-5-CONFIG_I: Configured from console by console