Configure Log Output Functions
Configuration Condition
None
Configure Log Output to the Control Console
The control console refers to a Console terminal. It is a channel through which the system output log information to the control console.
Table 9-4 Configuring Log Output to the Control Console
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enable the log output function.
|
logging enable
|
Optional.
By default, the log output function is enabled.
|
Enable log display on the control console.
|
logging source { module-name | default } console { level severity | deny }
|
Optional.
By default, log display on the control console is enabled.
|
Configure Log Output to the Monitor Console
The monitor console refers to the Telnet or SSH terminal. It is used for remote device management. To configure the log output to the monitor console, you need to enable the log display on the current terminal.
Table 9-5 Configuring Log Output to the Monitor Console
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enable the log output function.
|
logging enable
|
Optional.
By default, the log output function is enabled.
|
Enable log display on the monitor console.
|
logging source { module-name | default } monitor { level severity | deny }
|
Optional.
By default, the log display function of the global monitor console is enabled.
|
Enable log display of the current monitor console.
|
terminal monitor
|
Mandatory.
By default, log display on the current monitor console is disabled.
|
Configure Log Output to the Server
To record the log information in a more comprehensive manner, you can configure the log information output to the log server, which is convenient for the maintenance and management of the system. When configuring the log output to the log server, you need to configure the host address or domain name of the log server.
Table 9-6 Configuring Log Output to the Log Server
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enable the log output function.
|
logging enable
|
Optional.
By default, the log output function is enabled.
|
Configure the log output to the log server
|
logging server server-name [ vrf vrf-name ] { ip ip-address | ipv6 ipv6-address | hostname host-name} [ port port-num ] [ facility facility-name ] [level severity]
|
Mandatory
By default, do not configure the log output to the log server.
|
Configure the IP source address for sending the log information
|
logging server source { ip ip-address | ipv6 ipv6-address | interface interface-name }
|
Optional
By default, confirm the output interface of sending the log information by the route, and use the master IP address of the output interface as the source IP address of the sent log information.
|
Configure the log information of the specified level output to the log server
|
logging source { module-name | default } server [ server-name &<1-8> ] { level severity | deny }
|
Optional
By default, the log information of level 0-5 can be output to the log host.
|
Configure Log Output to Files
Log files can be stored in two manners, in the memory, and in the flash memory. The memory stores only the log information from device syslog startup to the system restarting or before syslog process restarting. By default, log information of level 5 (notifications) and higher levels are stored. By default, the flash memory stores log information of level 5 (notifications) and higher levels. For the levels of logs, refer to the detailed description in Table 9-1. Both the two types of log files have capacity limit. If the size of log files reaches the configured maximum capacity, first delete the oldest log file (the log information is recorded by multiple log files) when adding one log, and then, add one log file and record the log information to the new log file.
Table 9-7 Configuring Log Output to Files
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enable the log output function.
|
logging enable
|
Optional.
By default, the log output function is enabled.
|
Configure the log output to Flash
|
logging source { module-name | default } file { level severity | deny }
|
Optional
By default, the log information of level 0-5 is saved to Flash.
|
Configure the log output to memory
|
logging source { module-name | default } buffer { level severity | deny }
|
Optional
By default, the log information of level 0-5 is saved to memory.
|
Configure the log file capacity alarm
|
logging { buffer | file } warning warning-value recover-value
|
Optional
By default, the log information warning value is 90%, and the recover value is 70%.
|
Configure the log file compression
|
logging compress [ gunzip ]
logging compress max-num value
|
Optional
By default, do not enable the log compression function.
|
Configure Log Output to Email
In order to record the log information more comprehensively, we can configure the log information to be output to the email box of the recipient and copier through email.
Table 9-8 Configuring Log Output to Email
Step
|
Command
|
Description
|
Enter the global configuration mode.
|
configure terminal
|
-
|
Enable the log output function.
|
logging enable
|
Optional.
By default, the log output function is enabled.
|
Configure the email profile
|
logging email email-profile
|
Mandatory
By default, do not configure the profile of outputting the log to email.
|
Configure the email address of the recipient of the log information
|
mail recipient mail-address
|
Mandatory
By default, do not configure the email address of the recipient of the log information.
|
Configure the email address of the copier for receiving the log information
|
mail copyto mail-address
|
Optional
By default, do not configure the email address of the copier for receiving the log information.
|
Configure the email address of the sender of the log information
|
mail sender mail-address
|
Mandatory
By default, do not configure the email address of the sender of the log information.
|
Configure the email password of the sender of the log information
|
mail sender password password-string
|
Mandatory
By default, do not configure the email password of the sender of the log information.
|
Configure the email domain name address of the receiver of the log information
|
mail server server-name
|
Optional
By default, take the characters after the @ in the email address of the sender as the domain name address of the sender.
|
Configure the email subject of sending the log information
|
mail subject subject-name
|
Optional
By default, do not configure the email subject of sending the log information.
|
Configure the log information of the specified level output to the email box of the receiver and copier via email
|
logging source { module-name | default } email { level severity | deny }
|
Optional
By default, the log information of level 0-4 is output to email.
|