System Log

System Log Overview

Syslog is the system information center, to complete the unified processing and output of information.

The other modules in the system will send the output information to Syslog. Syslog determines the output format of the information according to the configuration of the user and outputs the information to the specified display device according to the information switching and filtering rules of each output direction configured by the user.

With the Syslog information producer, which is each module of output information, you do not need to export information to the console, Telnet terminal, or log host (Syslog server). You only need to output the information to Syslog. By configuring the appropriate filtering rules, information consumers, which are console, Telnet terminal, history buffer, log host and SNMP agent, a user can choose the desired information and discard unwanted information.

System Log Configuration

Enabling Syslog


Note

The logging function is enabled by default and stored in the buffer.


SUMMARY STEPS

  1. enable
  2. configure terminal
  3. logging
  4. show logging
  5. end

DETAILED STEPS

  Command or Action Purpose
Step 1

enable

Example:

Device> enable 

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal 

Enters global configuration mode.

Step 3

logging

Example:

Device(config)# logging 

Enables log function.

Step 4

show logging

Example:

Device(config)# show logging 

(Optional) Displays the configuration information.

Step 5

end

Example:

Device(config)# end 

(Optional) Exits the global configuration mode and returns to privileged EXEC mode.

Configuring the Log Serial Number


Note

The logging function is enabled by default.


SUMMARY STEPS

  1. enable
  2. configure terminal
  3. logging sequence-numbers
  4. end

DETAILED STEPS

  Command or Action Purpose
Step 1

enable

Example:

Device> enable 

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal 

Enters global configuration mode.

Step 3

logging sequence-numbers

Example:

Device(config)# logging sequence-numbers 

Enables the log serial number.

Step 4

end

Example:

Device(config)# end 

(Optional) Exits the global configuration mode and returns to privileged EXEC mode.

Configuring the Timestamp


Note

There is no separate timestamp switch. There are three timestamp types:

  • notime: do not show the time

  • uptime: show the boot time

  • datetime: show the date and time

The default is uptime.


SUMMARY STEPS

  1. enable
  2. configure terminal
  3. logging timestamps {notime | uptime | datetime}
  4. end

DETAILED STEPS

  Command or Action Purpose
Step 1

enable

Example:

Device> enable 

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal 

Enters global configuration mode.

Step 3

logging timestamps {notime | uptime | datetime}

Example:

Device(config)# logging timestamps datetime 

Configures the timestamp type.

Step 4

end

Example:

Device(config)# end 

(Optional) Exits the global configuration mode and returns to privileged EXEC mode.

Configuring the Log to Output to the Terminal

In privileged EXEC mode, configure the log to output to the terminal device. In global configuration mode, you can configure information display and filtering rules. By default, the device logs do not output to the terminal, but output to the buffer. There is a slight difference between the command for the serial terminal and the Telnet or SSH terminal.


Note

  • Log output to the terminal: In the serial console, the default configuration is terminal monitor; in other terminal console, the default is no terminal monitor.

  • Log information display: In the non-console terminal configuration, only affect this landing of the current terminal, the other terminals, the next landing of the current terminal is invalid.

  • monitor-num is 0 for the console, and 1 to 5 for Telnet and SSH terminals.

  • Output log default rule: All modules, log level 0-5,7. Deleting the filtering rule restores the default rule.


SUMMARY STEPS

  1. enable
  2. terminal monitor
  3. configure terminal
  4. logging monitor {all | monitor-num} [level_value | level-list level_value | none]
  5. show logging filter monitor monitor-num
  6. end

DETAILED STEPS

  Command or Action Purpose
Step 1

enable

Example:

Device> enable 

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

terminal monitor

Example:

Device# terminal monitor 

Enables output to the terminal.

Step 3

configure terminal

Example:

Device# configure terminal 

Enters global configuration mode.

Step 4

logging monitor {all | monitor-num} [level_value | level-list level_value | none]

Example:

Device(config)# logging monitor all 3 

(Optional) Enables log display and configures the filtering rules.

Step 5

show logging filter monitor monitor-num

Example:

Device(config)# show logging filter monitor 3 

(Optional) Displays the filtering rules.

Step 6

end

Example:

Device(config)# end 

(Optional) Exits the global configuration mode and returns to privileged EXEC mode.

Configuring the Log to Output to the Buffer


Note

The default is log output to buffer. The default rule is to output all modules and logs at the level 0-6. Deleting the filtering rule restores the default rule.


SUMMARY STEPS

  1. enable
  2. configure terminal
  3. logging buffered [level_value | level-list level_value | none]
  4. show logging filter buffered
  5. end

DETAILED STEPS

  Command or Action Purpose
Step 1

enable

Example:

Device> enable 

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal 

Enters global configuration mode.

Step 3

logging buffered [level_value | level-list level_value | none]

Example:

Device(config)# logging buffered 3 

Enables output to buffer and configures the filtering rules.

Step 4

show logging filter buffered

Example:

Device(config)# show logging filter buffered 

(Optional) Displays the filtering rules.

Step 5

end

Example:

Device(config)# end 

(Optional) Exits the global configuration mode and returns to privileged EXEC mode.

Configuring the Log to Output to the Flash

In global configuration mode, you can configure Syslog to save to Flash, which is not saved in flash memory by default.


Note

  • When the log is output to flash, the default rule is to output all modules and the log level is 0-5. Deleting the filtering rule restores the default rules.

  • When the log is output to flash, the default cycle is 30M. By default, 100 logs are saved at one time.


SUMMARY STEPS

  1. enable
  2. configure terminal
  3. logging flash [level_value | interval interval-value | level-list level_value | msg-number msg-num-value | none]
  4. show logging filter flash
  5. show logging flash[ [level_value | count | level-list level_value ] module module-name ]
  6. end

DETAILED STEPS

  Command or Action Purpose
Step 1

enable

Example:

Device> enable 

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal 

Enters global configuration mode.

Step 3

logging flash [level_value | interval interval-value | level-list level_value | msg-number msg-num-value | none]

Example:

Device(config)# logging flash msg-number 220 

Enables output to flash and configures the filtering rules.

Step 4

show logging filter flash

Example:

Device(config)# show logging filter flash 

(Optional) Displays the filtering rules.

Step 5

show logging flash[ [level_value | count | level-list level_value ] module module-name ]

Example:

Device(config)# show logging flash 

(Optional) Displays the log information in the flash.

Step 6

end

Example:

Device(config)# end 

(Optional) Exits the global configuration mode and returns to privileged EXEC mode.

Configuring the Log to Output to the External Server

Configure the specified server address for log output, information output switch, filtering rule, and logging tool and source address in global configuration mode.


Note

  • The sip of log messages must be the interface of the device. The Layer 3 device uses the IP address of the corresponding interface of the log server by default. The Layer 2 device automatically uses the system IP and does not need to be configured.

  • The default logging tool name uses localuse7.


SUMMARY STEPS

  1. enable
  2. configure terminal
  3. logging ip-address
  4. logging host {ip-address | all} [level_value | level-list level_value | none]
  5. logging facility {clock1 | clock2 | ftp | kernel | lineprinter | localuse0 | localuse1 | localuse2 | localuse3 | localuse4 | localuse5 | localuse6 | localuse7 | logalert | logaudit | mail | networknews | ntp | security1 | security2 | syslogd | system | userlevel | uucp}
  6. logging source ip-address
  7. end

DETAILED STEPS

  Command or Action Purpose
Step 1

enable

Example:

Device> enable 

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal 

Enters global configuration mode.

Step 3

logging ip-address

Example:

Device(config)# logging 10.1.1.10 

Configures the log server.

Step 4

logging host {ip-address | all} [level_value | level-list level_value | none]

Example:

Device(config)# logging host all 

Enables the log server and configures the filtering rules.

Step 5

logging facility {clock1 | clock2 | ftp | kernel | lineprinter | localuse0 | localuse1 | localuse2 | localuse3 | localuse4 | localuse5 | localuse6 | localuse7 | logalert | logaudit | mail | networknews | ntp | security1 | security2 | syslogd | system | userlevel | uucp}

Example:

Device(config)# logging facility log1 

(Optional) Configures the logging tool name.

Step 6

logging source ip-address

Example:

Device(config)# logging source 10.1.1.11 

(Optional) Configures the sip for log packet.

Step 7

end

Example:

Device(config)# end 

(Optional) Exits the global configuration mode and returns to privileged EXEC mode.

Configuring the Log to Output to the SNMP Agent

Configure Syslog output to the SNMP agent in global configuration mode. To send Syslog messages to SNMP Workstation in trap messages, you must also configure the Trap host address. Refer to the SNMP configuration instructions.

By default, logs are not set to output to the SNMP agent.

SUMMARY STEPS

  1. enable
  2. configure terminal
  3. logging snmp-agent
  4. logging snmp-agent {level_value | level-list level_value | none]
  5. show logging filter snmp-agent
  6. end

DETAILED STEPS

  Command or Action Purpose
Step 1

enable

Example:

Device> enable 

Enables privileged EXEC mode.

Enter your password if prompted.

Step 2

configure terminal

Example:

Device# configure terminal 

Enters global configuration mode.

Step 3

logging snmp-agent

Example:

Device(config)# logging 10.1.1.10 

Enables log output to the SNMP agent.

Step 4

logging snmp-agent {level_value | level-list level_value | none]

Example:

Device(config)# logging snmp-agent none 

(Optional) Configures the filtering rules.

Step 5

show logging filter snmp-agent

Example:

Device(config)# show logging filter snmp-agent 

(Optional) Displays the filtering rules.

Step 6

end

Example:

Device(config)# end 

(Optional) Exits the global configuration mode and returns to privileged EXEC mode.

Monitoring the System Log

In the global configuration mode, you can configure the debugging function to print the debugging information of the corresponding module. By default, debugging information of all modules is disabled.

Command Purpose

debug {all | module_name}

Enables debugging function.

show debug

Displays the configuration information.

Example: Syslog Configuration

This example shows how to output the logs of the STP module and the device module at levels 0-4 to the console terminal: turn on the serial number display, use timestamp datetime, log output to the flash memory, log information of level 3 and 4 to output to buffer, output logs to external server 10.1.1.3, and open ARP debugging information.

The following example shows the system log configuration.

Device> enable
Device# terminal monitor
Device# configure terminal 
Device(config)# logging
Device(config)# logging monitor all
Device(config)# logging monitor all level-list 0 to 4 module stp device 
Device(config)# logging sequence-numbers 
Device(config)# logging timestamps datetime 
Device(config)# logging flash
Device(config)# logging buffered level-list 3 4
Device(config)# logging 10.1.1.3 
Device(config)# logging host 10.1.1.3 
Device(config)# logging facility ftp 
Device(config)# debug ARP 
Device(config)# logging flash 

The following example shows the logging configuration information.

Device> enable
Device# configure terminal 
Device(config)# show logging
 
state: on;
logging sequence-numbers: on;
logging timestamps: datetime;
logging language: english
logging monitor: 
Console:   state: on;  display: off;  96 logged;  0 lost;  0 overflow.
logging buffered:  state: on;  249 logged;    0 lost;     0 overflow.
logging flash:  state: on;  37 logged;     0 lost;     0 overflow.
logging loghost: 
logging facility: ftp;logging source: off
10.1.1.3:     state: on;  23 logged;     0 lost;     0 overflow.
logging SNMP Agent:  state: off;  0 logged;      0 lost;     0 overflow.