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
]
{
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.
|
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.10.1a
|
This command was introduced.
|
Usage Guidelines
For usage guidelines, see the Cisco IOS XE service timestamps command.
The following example shows how to enable time-stamping on logging messages using the current time and date in Coordinated
Universal Time/Greenwich Mean Time (UTC/GMT), and enable the year to be displayed:
Device(config)# service timestamps log datetime show-timezone year
Device(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
In the following example, the service timestamps log datetime command is used to change previously configured options for the date-time time stamp.
Device(config)# service timestamps log datetime localtime show-timezone
Device(config)# end
! The year is not displayed.
Oct 13 15:44:46 PDT: %SYS-5-CONFIG_I: Configured from console by console
Enter configuration commands, one per line. End with the end command.
Device(config)# service timestamps log datetime show-timezone year
Device(config)# end
! note: because the localtime option was not specified again, that option is removed from the output,
and time is displayed in UTC (the default)
Oct 13 2004 22:45:31 UTC: %SYS-5-CONFIG_I: Configured from console by console