To configure the system to time-stamp debugging or logging messages, use one of the service timestamps global configuration commands. Use the no form of this command to disable this service.
service timestamps type [uptime]
service timestamps type datetime [msec] [localtime] [show-timezone]
no service timestamps type
Syntax Description
type
Type of message to time stamp: debug or log.
uptime
(Optional) Time stamp with time since the system was rebooted.
datetime
Time stamp with the date and time.
msec
(Optional) Include milliseconds in the date and time stamp.
localtime
(Optional) Time stamp relative to the local time zone.
show-timezone
(Optional) Include the time zone name in the time stamp.
Defaults
No time-stamping.
If service timestamps is specified with no arguments or keywords, default is service timestamps debug uptime.
The default for service timestamps type datetime is to format the time in UTC, with no milliseconds and no time zone name.
The command no service timestamps by itself disables time stamps for both debug and log messages.
Command Modes
Global configuration
Command History
Release Modification 10.0
This command was introduced.
Usage Guidelines
Time stamps can be added to either debugging or logging messages independently. The uptime form of the command adds time stamps in the format HHHH:MM:SS, indicating the time since the system was rebooted. The datetime form of the command adds time stamps in the format MMM DD HH:MM:SS, indicating the date and time according to the system clock. If the system clock has not been set, the date and time are preceded by an asterisk (*) to indicate that the date and time are probably not correct.
Examples
The following example enables time stamps on debugging messages, showing the time since reboot:
service timestamps debug uptimeThe following example enables time stamps on logging messages, showing the current time and date relative to the local time zone, with the time zone name included:
service timestamps log datetime localtime show-timezone