Logging messages generated by the router are sent to the logging process. It controls the distribution of the messages to various destinations. If the logging process is off, then only the console receives log messages. To enable logging, use:
R(config)# logging on
Without this command only the console will receive logs.
Logging Destination
R(config)# logging buffered [SIZE]
! Logs messages to an internal memory buffer.
R(config)# logging HOST-IP [LEVEL]
! Logs messages to a syslog server host.
R(config)# logging trap LEVEL
! Must be enabled in order to log messages to Syslog Host
R(config)# logging persistent
R(config)# logging file FILENAME [MAX-SIZE [MIN-SIZE]] [LEVEL]
! Logs messages to a file
R(config)# logging console
! Logs messages to con0 output
R(config)# logging monitor
! Logs messages to vty output
By default, debug information only appears on the console terminal. To show them on the current terminal, use:
Router# terminal monitor
By default, unsolicited debug information will interrupt solicited display information. Using synchronous logging, unsolicited debug information will only be displayed after the solicited information is displayed.
By default, log messages are not time-stamped, but tou can set timestamping using:
R(config)# service timestamps log { uptime | datetime [msec] [localtime] [show-timezone]}
! uptime – time since last reboot
! datetime - Current Datetime in UTC
! localtime – Shows the time in the configured timezone
! msec – adds milisec to the timestamp
! show-timezone – adds timezone to the time
Separate settings can be configure for debug messages:
You can also enable the services for adding sequence numbers to the log:
R(config)# service sequence-numbers
Error message level
R(config)# logging {console|monitor|trap} LEVEL
Additional settings
! Add an origin Identifier:
R(config)# logging origin-id {hostname|ip|ipv6|string STRING}
! Rate limit log messages per second:
R(config)# logging rate-limit [all|console] MESSAGES-PER-SEC [except LEVEL]
! Set the source of syslog messages:
R(config)# logging source-interface INTERFACE
! Log user information when a user uses the enable command:
R(config)# logging userinfo
Logging configuration changes
R(config)# archive
R(config-archive)# log config
R(config-archive-log-cfg)# logging enable
R(config-archive-log-cfg)# logging size SIZE
R(config-archive-log-cfg)# hidekeys
! Suppresses the display of passwords
R(config-archive-log-cfg)# notify syslog
! Enables sending of configuration changes to a syslog server