Configuring the timestamp format using the CLI

Prev Next

This topic describes how to use CLI commands to specify the syslog timestamp format. For a full list of logging commands and the usage and parameters, see the CLI Command Reference.

Prerequisites
  • Admin access

To configure the timestamp format used in log messages:
  1. Go to CLI configuration mode:

    hostname > enable
    hostname # configure terminal
  2. Enter the logging fields timestamp format <format> command, where <format> is one of the following:

    • rfc-3164—Use the timestamp format specified in RFC-3164 (for example, May 13 15:12:01).

    • rfc-3339—Use the timestamp format specified in RFC-3339 (for example, 2017-05-15T15:22:33).

    The following example specifies that all log messages use RFC-3339 format:

    hostname (config) # logging fields timestamp format rfc-3339
  3. Verify your changes:

    hostname (config) # show logging
       Local logging level:                err
    
       Remote syslog default level:        notice
       No remote syslog servers configured.
    
    Receive remote messages via UDP:       no
    
    Receive remote messages via TCP:       no
    
    Receive remote messages via TLS:       no
    
    Log file rotation:
       Log rotation size threshold:        256 megabytes
       Archived log files to keep:         40
    
    Log format:
       Timestamp format:                   rfc-3339
    
       Subsecond timestamp field:          disabled
    
    Secure channel logs:                   no
  4. Save your changes.

    hostname (config) # write memory