Setting the Timestamp for Log Messages
You can use the service timestamps command to format timestamps for log messages. By default, log messages display universal coordinated time (UTC) without the time zone.
The following examples illustrate how you can change the timestamp on log messages.
- Set the time zone to eastern daylight time (EDT), 5 hours behind UTC, and display the local time on the log messages.
host1(config)#clock timezone EDT -5Display UTC, but no time zone, on the log messages. host1(config)#service timestamps log datetimehost1#exithost1#show log data category cliCommand severity info***********************************************************NOTICE 05/14/2001 18:24:49 cliCommand: "configure terminal", consoleNOTICE 05/14/2001 18:24:45 cliCommand: "service timestamps log datetime", console***********************************************************Display UTC and the time zone on the log messages. host1#configure terminalhost1(config)#service timestamps log datetime show-timezonehost1(config)#exithost1#show log data category cliCommand severity info***********************************************************NOTICE 05/14/2001 18:28:45 UTC EDT cliCommand: "configure terminal", consoleNOTICE 05/14/2001 18:28:42 UTC EDT cliCommand: "service timestamps log datetime show-timezone", console***********************************************************Display no timestamp on the log messages. host1#configure terminalhost1(config)#no service timestampshost1#exithost1#show log data category cliCommand severity info***********************************************************NOTICE 134 cliCommand: "configure terminal", consoleNOTICE 133 cliCommand: "no service timestamps", console***********************************************************service timestamps
- Use to format timestamps for log messages.
- For information about setting local times and time zones, see JUNOSe System Basics Configuration Guide, Chapter 12, Configuring the System Clock.
- The show log data command displays the log data with the current timestamp format.
- The show log data nv-file command displays the log data with the timestamp format in effect at the time the log record was written.
- Use the no version to remove timestamps from log messages.