Contents
- Configuring System Message Logging
- Information About System Message Logging
- syslog Servers
- Configuring System Message Logging
- Configuring System Message Logging to Terminal Sessions
- Configuring System Message Logging to a File
- Configuring Module and Facility Messages Logging
- Configuring Logging Timestamps
- Configuring syslog Servers
- Configuring syslog on a UNIX or Linux System
- Configuring syslog Server Configuration Distribution
- Displaying and Clearing Log Files
- Verifying System Message Logging Configuration
- Default System Message Logging Settings
Configuring System Message Logging
This chapter describes how to configure system message logging on the Cisco Nexus 5000 Series switch and contains the following sections:
- Information About System Message Logging
- Configuring System Message Logging
- Verifying System Message Logging Configuration
- Default System Message Logging Settings
Information About System Message Logging
You can use system message logging to control the destination and to filter the severity level of messages that system processes generate. You can configure logging to terminal sessions, a log file, and syslog servers on remote systems.
By default, the Cisco Nexus 5000 Series switch outputs messages to terminal sessions.
By default, the switch logs system messages to a log file.
The following table describes the severity levels used in system messages. When you configure the severity level, the system outputs messages at that level and lower.
Table 1 System Message Severity Levels Level
Description
0 – emergency
System unusable
1 – alert
Immediate action needed
2 – critical
Critical condition
3 – error
Error condition
4 – warning
Warning condition
5 – notification
Normal but significant condition
6 – informational
Informational message only
7 – debugging
Appears during debugging only
The switch logs the most recent 100 messages of severity 0, 1, or 2 to the NVRAM log. You cannot configure logging to the NVRAM.
You can configure which system messages should be logged based on the facility that generated the message and its severity level.
syslog Servers
syslog servers run on remote systems that are configured to log system messages based on the syslog protocol. You can configure the Cisco Nexus 5000 Series to sends its logs to up to three syslog servers.
To support the same configuration of syslog servers on all switches in a fabric, you can use the Cisco Fabric Services (CFS) to distribute the syslog server configuration.
Note
When the switch first initializes, messages are sent to syslog servers only after the network is initialized.
Configuring System Message Logging to Terminal Sessions
SUMMARY STEPSYou can configure the switch to log messages by their severity level to console, Telnet, and SSH sessions.
By default, logging is enabled for terminal sessions.
3. switch(config)# logging console [severity-level]
4. (Optional) switch(config)# no logging console [severity-level]
5. switch(config)# logging monitor [severity-level]
6. (Optional) switch(config)# no logging monitor [severity-level]
7. (Optional) switch# show logging console
8. (Optional) switch# show logging monitor
9. (Optional) switch# copy running-config startup-config
DETAILED STEPSThe following example shows how to configure a logging level of 3 for the console:
switch# configure terminalswitch(config)# logging console 3The following example shows how to display the console logging configuration:
switch# show logging consoleLogging console: enabled (Severity: error)The following example shows how to disable logging for the console:
switch# configure terminalswitch(config)# no logging consoleThe following example shows how to configure a logging level of 4 for the terminal session:
switch# terminal monitorswitch# configure terminalswitch(config)# logging monitor 4The following example shows how to display the terminal session logging configuration:
switch# show logging monitorLogging monitor: enabled (Severity: warning)The following example shows how to disable logging for the terminal session:
switch# configure terminalswitch(config)# no logging monitorConfiguring System Message Logging to a File
SUMMARY STEPSYou can configure the switch to log system messages to a file. By default, system messages are logged to the file log:messages.
2. switch(config)# logging logfile logfile-name severity-level [size bytes]
3. (Optional) switch(config)# no logging logfile [logfile-name severity-level [size bytes]]
4. (Optional) switch# show logging info
5. (Optional) switch# copy running-config startup-config
DETAILED STEPSThe following example shows how to configure a switch to log system messages to a file:
switch# configure terminalswitch(config)# logging logfile my_log 6 size 4194304The following example shows how to display the logging configuration (some of the output has been removed for brevity):
switch# show logging infoLogging console: enabled (Severity: debugging)Logging monitor: enabled (Severity: debugging)Logging linecard: enabled (Severity: notifications)Logging fex: enabled (Severity: notifications)Logging timestamp: SecondsLogging server: disabledLogging logfile: enabledName - my_log: Severity - informational Size - 4194304Facility Default Severity Current Session Severity-------- ---------------- ------------------------aaa 3 3aclmgr 3 3afm 3 3altos 3 3auth 0 0authpriv 3 3bootvar 5 5callhome 2 2capability 2 2cdp 2 2cert_enroll 2 2...Configuring Module and Facility Messages Logging
SUMMARY STEPSYou can configure the severity level and time-stamp units of messages logged by modules and facilities.
2. switch(config)# logging module [severity-level]
3. switch(config)# logging level facility severity-level
4. (Optional) switch(config)# no logging module [severity-level]
5. (Optional) switch(config)# no logging level [facility severity-level]
6. (Optional) switch# show logging module
7. (Optional) switch# show logging level [facility]
8. (Optional) switch# copy running-config startup-config
DETAILED STEPSConfiguring Logging Timestamps
SUMMARY STEPS2. switch(config)# logging timestamp {microseconds | milliseconds | seconds}
3. (Optional) switch(config)# no logging timestamp {microseconds | milliseconds | seconds}
4. (Optional) switch# show logging timestamp
5. (Optional) switch# copy running-config startup-config
DETAILED STEPS
Command or Action Purpose Step 1 switch# configure terminal
Enters configuration mode.
Step 2 switch(config)# logging timestamp {microseconds | milliseconds | seconds}
Sets the logging time-stamp units. By default, the units are seconds.
Step 3 switch(config)# no logging timestamp {microseconds | milliseconds | seconds}
(Optional) Resets the logging time-stamp units to the default of seconds.
Step 4 switch# show logging timestamp
(Optional) Displays the logging time-stamp units configured.
Step 5 switch# copy running-config startup-config
(Optional) Copies the running configuration to the startup configuration.
Configuring syslog Servers
SUMMARY STEPSYou can configure up to three syslog servers that reference remote systems where you want to log system messages.
2. switch(config)# logging server host [severity-level [use-vrf vrf-name [facility facility]]]
3. (Optional) switch(config)# no logging server host
4. (Optional) switch# show logging server
5. (Optional) switch# copy running-config startup-config
DETAILED STEPS
Command or Action Purpose Step 1 switch# configure terminal
Enters configuration mode.
Step 2 switch(config)# logging server host [severity-level [use-vrf vrf-name [facility facility]]]
Configures a host to receive syslog messages.
- The host argument identifies the host name or the IPv4 or IPv6 address of the syslog server host.
- The severity-level argument limits the logging of messages to the syslog server to a specified level. Severity levels range from 0 to 7. Refer to Table 1
- The use vrf vrf-name keyword argument identifies the default or management values for the VRF name. If a specific VRF is not identified, management is the default. However, if management is configured, it will not be listed in the output of the show-running command because it is the default. If a specific VRF is configured, the show-running command output will list the VRF for each server.
Note The current CFS distribution does not support VRF. If CFS distribution is enabled, then the logging server configured with the default VRF will be distributed as the management VRF. - The facility argument names the syslog facility type. The facilities are listed in the Cisco Nexus 5000 Series Command Reference. The default outgoing facility is local7.
Step 3 switch(config)# no logging server host
(Optional) Removes the logging server for the specified host.
Step 4 switch# show logging server
(Optional) Displays the syslog server configuration.
Step 5 switch# copy running-config startup-config
(Optional) Copies the running configuration to the startup configuration.
Configuring syslog on a UNIX or Linux System
SUMMARY STEPSYou can configure a syslog server on a UNIX or Linux system by adding the following line to the /etc/syslog.conf file:
facility.level <five tab characters> actionThe following table describes the syslog fields that you can configure.
Table 3 syslog Fields in syslog.conf Field
Description
Facility
Creator of the message, which can be auth, authpriv, cron, daemon, kern, lpr, mail, mark, news, syslog, user, local0 through local7, or an asterisk (*) for all. These facility designators allow you to control the destination of messages based on their origin.
Note Check your configuration before using a local facility.
Level
Minimum severity level at which messages are logged, which can be debug, info, notice, warning, err, crit, alert, emerg, or an asterisk (*) for all. You can use none to disable a facility.
Action
Destination for messages, which can be a filename, a host name preceded by the at sign (@), or a comma-separated list of users or an asterisk (*) for all logged-in users.
1. Log debug messages with the local7 facility in the file /var/log/myfile.log by adding the following line to the /etc/syslog.conf file:
2. Create the log file by entering these commands at the shell prompt:
3. Make sure the system message logging daemon reads the new changes by checking myfile.log after entering this command:
DETAILED STEPS
Configuring syslog Server Configuration Distribution
SUMMARY STEPSYou can distribute the syslog server configuration to other switches in the network by using the Cisco Fabric Services (CFS) infrastructure.
After you enable syslog server configuration distribution, you can modify the syslog server configuration and view the pending changes before committing the configuration for distribution. As long as distribution is enabled, the switch maintains pending changes to the syslog server configuration.
Note
If the switch is restarted, the syslog server configuration changes that are kept in volatile memory may be lost.
2. switch(config)# logging distribute
3. switch(config)# logging commit
4. switch(config)# logging abort
5. (Optional) switch(config)# no logging distribute
6. (Optional) switch# show logging pending
7. (Optional) switch# show logging pending-diff
8. (Optional) switch# show logging internal info
9. (Optional) switch# copy running-config startup-config
DETAILED STEPS
Command or Action Purpose Step 1 switch# configure terminal
Enters configuration mode.
Step 2 switch(config)# logging distribute
Enables distribution of syslog server configuration to network switches using the CFS infrastructure. By default, distribution is disabled.
Step 3 switch(config)# logging commit
Commits the pending changes to the syslog server configuration for distribution to the switches in the fabric.
Step 4 switch(config)# logging abort
Cancels the pending changes to the syslog server configuration.
Step 5 switch(config)# no logging distribute
(Optional) Disables distribution of syslog server configuration to network switches using the CFS infrastructure. You cannot disable distribution when configuration changes are pending. See the logging commit and logging abort commands. By default, distribution is disabled.
Step 6 switch# show logging pending
(Optional) Displays the pending changes to the syslog server configuration.
Step 7 switch# show logging pending-diff
(Optional) Displays the differences from the current syslog server configuration to the pending changes of the syslog server configuration.
Step 8 switch# show logging internal info
(Optional) Displays information about the current state of syslog server distribution and the last action taken.
Step 9 switch# copy running-config startup-config
(Optional) Copies the running configuration to the startup configuration.
Displaying and Clearing Log Files
SUMMARY STEPS1. switch# show logging last number-lines
2. switch# show logging logfile [start-time yyyy mmm dd hh:mm:ss] [end-time yyyy mmm dd hh:mm:ss]
3. switch# show logging nvram [last number-lines]
4. switch# clear logging logfile
5. switch# clear logging nvram
DETAILED STEPS
Command or Action Purpose Step 1 switch# show logging last number-lines
Displays the last number of lines in the logging file. You can specify from 1 to 9999 for the last number of lines.
Step 2 switch# show logging logfile [start-time yyyy mmm dd hh:mm:ss] [end-time yyyy mmm dd hh:mm:ss]
Displays the messages in the log file that have a time stamp within the span entered. If you do not enter an end time, the current time is used. You enter three characters for the month time field, and digits for the year and day time fields.
Step 3 switch# show logging nvram [last number-lines]
Displays the messages in the NVRAM. To limit the number of lines displayed, you can enter the last number of lines to display. You can specify from 1 to 100 for the last number of lines.
Step 4 switch# clear logging logfile
Clears the contents of the log file.
Step 5 switch# clear logging nvram
Clears the logged messages in NVRAM.
The following example shows how to display messages in a log file:
switch# show logging last 40switch# show logging logfile start-time 2007 nov 1 15:10:0switch# show logging nvram last 10The following example shows how to clear messages in a log file:
switch# clear logging logfileswitch# clear logging nvramVerifying System Message Logging Configuration
To display system message logging configuration information, perform one of the following tasks:
Command
Purpose
switch# show logging console Displays the console logging configuration.
switch# show logging info Displays the logging configuration.
switch# show logging internal info Displays the syslog distribution information.
switch# show logging last number-lines Displays the last number of lines of the log file.
switch# show logging level [facility] Displays the facility logging severity level configuration.
switch# show logging logfile [start-time yyyy mmm dd hh:mm:ss] [end-time yyyy mmm dd hh:mm:ss] Displays the messages in the log file.
switch# show logging module Displays the module logging configuration.
switch# show logging monitor Displays the monitor logging configuration.
switch# show logging nvram [last number-lines] Displays the messages in the NVRAM log.
switch# show logging pending Displays the syslog server pending distribution configuration.
switch# show logging pending-diff Displays the syslog server pending distribution configuration differences.
switch# show logging server Displays the syslog server configuration.
switch# show logging session Displays the logging session status.
switch# show logging status Displays the logging status.
switch# show logging timestamp Displays the logging time-stamp units configuration.
Default System Message Logging Settings
The following table lists the default settings for system message logging parameters.
Table 4 Default System Message Logging Parameters Parameters
Default
Console logging
Enabled at severity level 2
Monitor logging
Enabled at severity level 2
Log file logging
Enabled to log:messages at severity level 5
Module logging
Enabled at severity level 5
Facility logging
Enabled;
Time-stamp units
Seconds
syslog server logging
Disabled
syslog server configuration distribution
Disabled