service timestamps To configure the system to timestamp 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 timestamp: debug or log.
uptime
(Optional) Timestamp with time since the system was rebooted.
datetime
Timestamp with the date and time.
msec
(Optional) Include milliseconds in the date and timestamp.
localtime
(Optional) Timestamp> show-timezone
(Optional) Include the time zone name in the timestamp.
Defaults
No timestamping.
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 timestamps for both debug and log messages.
Command Modes
Global configuration
Command History
Release Modification
10.0
This command was introduced.
Usage Guidelines
Timestamps can be added to either debugging or logging messages independently. The uptime form of the command adds timestamps in the format HHHH:MM:SS, indicating the time since the system was rebooted. The datetime form of the command adds timestamps 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 timestamps on debugging messages, showing the time since reboot:
service timestamps debug uptime
The following example enables timestamps on logging messages, showing the current time and date> service timestamps log datetime localtime show-timezone
Related Commands
Command Description
clock set
Manually set the system clock.
ntp
Controls access to the system's Network Time Protocol (NTP) services.