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.
System message logging is based on
RFC 3164
. For more information about the system message format and the messages that the device generates, see the
Cisco NX-OS System Messages Reference
.
By default, the device outputs messages to terminal sessions. For information about configuring logging to terminal sessions, see the “Configuring System Message Logging to Terminal Sessions” section.
By default, the device logs system messages to a log file. For information about configuring logging to a file, see the “Logging System Messages to a File” section.
Table 8-1
describes the severity levels used in system messages. When you configure the severity level, the system outputs messages at that level and lower.
.
Table 8-1 System Message Severity Levels
|
|
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 device 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. For information about facilities, see the
Cisco Nexus 7000 Series NX-OS System Management Command Reference
. For information about configuring the severity level by module and facility, see the “Configuring Module and Facility Messages Logged” section.
This section includes the following topics:
syslog Servers
The syslog servers run on remote systems that log system messages based on the syslog protocol. You can configure up to eight IPv4 or IPv6 syslog servers. For information about configuring syslog servers, see the “Configuring syslog Servers” section.
Note When the device first initializes, messages are sent to syslog servers only after the network is initialized.
Virtualization Support
A virtual device context (VDC) is a logical representation of a set of system resources. System message logging applies only to the VDC where commands are entered.
For information about configuring VDCs, see the
Cisco Nexus 7000 Series NX-OS Virtual Device Context Configuration Guide, Release 5.x
.
Configuring System Message Logging
This section includes the following topics:
Note Be aware that the Cisco NX-OS commands for this feature may differ from those commands used in Cisco IOS.
Configuring System Message Logging to Terminal Sessions
You can configure the device to log messages by their severity level to console, Telnet, and SSH sessions.
By default, logging is enabled for terminal sessions.
Tip The current critical (default) logging level is maintained if the console baud speed is 9600 baud (default). All attempts to change the console logging level generate an error message. To increase the logging level (above critical), you must change the console baud speed to 38400 baud.
BEFORE YOU BEGIN
Make sure that you are in the correct VDC. To change the VDC, use the
switchto vdc
command.
SUMMARY STEPS
1.
terminal monitor
2.
config t
3.
logging console
[
severity-level
]
no logging console
4.
show logging console
5.
logging monitor
[
severity-level
]
no logging monitor
6.
show logging monitor
7. logging message interface type ethernet description
no logging message interface type ethernet description
8.
copy running-config startup-config
|
|
|
Step 1
|
terminal monitor
Example:
switch# terminal monitor
|
Enables the device to log messages to the console.
|
Step 2
|
config t
Example:
switch# config t
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)#
|
Places you in global configuration mode.
|
Step 3
|
logging console
[
severity-level
]
Example:
switch(config)# logging console 3
|
Configures the device to log messages to the console session based on a specified severity level or higher. Severity levels, which can range from 0 to 7, are listed in
Table 8-1
. If the severity level is not specified, the default of 2 is used.
|
no logging console
[
severity-level
]
Example:
switch(config)# no logging console
|
Disables the device’s ability to log messages to the console.
|
Step 4
|
show logging console
Example:
switch(config)# show logging console
|
(Optional) Displays the console logging configuration.
|
Step 5
|
logging monitor
[
severity-level
]
Example:
switch(config)# logging monitor 3
|
Enables the device to log messages to the monitor based on a specified severity level or higher. The configuration applies to Telnet and SSH sessions. Severity levels, which can range from 0 to 7, are listed in
Table 8-1
. If the severity level is not specified, the default of 2 is used.
|
no logging monitor
[
severity-level
]
Example:
switch(config)# no logging monitor
|
Disables logging messages to Telnet and SSH sessions.
|
Step 6
|
show logging monitor
Example:
switch(config)# show logging monitor
|
(Optional) Displays the monitor logging configuration.
|
Step 7
|
logging message interface type ethernet description
Example:
switch(config)# logging message interface type ethernet description
|
Enables you to add the description for physical Ethernet interfaces and subinterfaces in the system message log. The description is the same description that was configured on the interface.
|
no logging message interface type ethernet description
Example:
switch(config)# no logging message interface type ethernet description
|
Disables the printing of the interface description in the system message log for physical Ethernet interfaces.
|
Step 8
|
copy running-config startup-config
Example:
switch(config)# copy running-config startup-config
|
(Optional) Copies the running configuration to the startup configuration.
|
Logging System Messages to a File
You can configure the device to log system messages to a file. By default, system messages are logged to the file log:messages.
For information about displaying and clearing log files, see the “Displaying and Clearing Log Files” section.
BEFORE YOU BEGIN
Make sure that you are in the correct VDC. To change the VDC, use the
switchto vdc
command.
SUMMARY STEPS
1.
config t
2.
logging logfile
logfile-name severity-level
[
size
bytes
]
no logging logfile
[
logfile-name severity-level
[
size
bytes
]]
3.
logging event {link-status | trunk-status} {enable | default}
4.
show logging info
5.
copy running-config startup-config
|
|
|
Step 1
|
config t
Example:
switch# config t
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)#
|
Places you in global configuration mode.
|
Step 2
|
logging logfile
logfile-name
severity-level
[
size
bytes
]
Example:
switch(config)# logging logfile my_log 6
|
Configures the name of the log file used to store system messages and the minimum severity level to log. You can optionally specify a maximum file size. The default severity level is 5 and the file size is 10485760. Severity levels are listed in
Table 8-1
. The file size is from 4096 to 10485760 bytes.
|
no logging logfile
[
logfile-name
severity-level
[
size
bytes
]]
Example:
switch(config)# no logging logfile
|
Disables logging to the log file.
|
Step 3
|
logging event {link-status | trunk-status} {enable | default}
Example:
switch(config)# logging event link-status default
|
Logs interface events.
-
link-status
—Logs all UP/DOWN and CHANGE messages.
-
trunk-status
—Logs all TRUNK status messages.
-
enable
—Specifies to enable logging to override the port level configuration.
-
default
—Specifies that the default logging configuration is used by interfaces not explicitly configured.
|
Step 4
|
show logging info
Example:
switch(config)# show logging info
|
(Optional) Displays the logging configuration.
|
Step 5
|
copy running-config startup-config
Example:
switch(config)# copy running-config startup-config
|
(Optional) Copies the running configuration to the startup configuration.
|
Configuring Module and Facility Messages Logged
You can configure the severity level and time-stamp units of messages logged by modules and facilities.
BEFORE YOU BEGIN
Make sure that you are in the correct VDC. To change the VDC, use the
switchto vdc
command.
SUMMARY STEPS
1.
config t
2.
logging module
[
severity-level
]
no logging module
3.
show logging module
4.
logging level
facility severity-level
no logging level
[
facility severity-level
]
5.
show logging level
[
facility
]
6.
logging timestamp
{
microseconds
|
milliseconds
|
seconds
}
no logging timestamp
{
microseconds
|
milliseconds
|
seconds
}
7.
show logging timestamp
8.
copy running-config startup-config
|
|
|
Step 1
|
config t
Example:
switch# config t
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)#
|
Places you in global configuration mode.
|
Step 2
|
logging module
[
severity-level
]
Example:
switch(config)# logging module 3
|
Enables module log messages that have the specified severity level or higher. Severity levels, which range from 0 to 7, are listed in
Table 8-1
. If the severity level is not specified, the default of 5 is used.
|
no logging module
[
severity-level
]
Example:
switch(config)# no logging module
|
Disables module log messages.
|
Step 3
|
show logging module
Example:
switch(config)# show logging module
|
(Optional) Displays the module logging configuration.
|
Step 4
|
logging level
facility severity-level
Example:
switch(config)# logging level aaa 2
|
Enables logging messages from the specified facility that have the specified severity level or higher. The facilities are listed in the
Cisco Nexus 7000 Series NX-OS System Management Command Reference
. Severity levels, which range from 0 to 7, are listed in
Table 8-1
. To apply the same severity level to all facilities, use the
all
facility. For defaults, see the
show logging level
command.
|
no logging level
[
facility severity-level
]
Example:
switch(config)# no logging level aaa 3
|
Resets the logging severity level for the specified facility to its default level. If you do not specify a facility and severity level, the device resets all facilities to their default levels.
|
Step 5
|
show logging level
[
facility
]
Example:
switch(config)# show logging level aaa
|
(Optional) Displays the logging level configuration and the system default level by facility. If you do not specify a facility, the device displays levels for all facilities.
|
Step 6
|
logging timestamp
{
microseconds
|
milliseconds
|
seconds
}
Example:
switch(config)# logging timestamp milliseconds
|
Sets the logging time-stamp units. By default, the units are seconds.
Note This command applies to logs that are kept in the switch. It does not apply to the external logging server.
|
no logging timestamp
{
microseconds
|
milliseconds
|
seconds
}
Example:
switch(config)# no logging timestamp milliseconds
|
Resets the logging time-stamp units to the default of seconds.
Note This command applies to logs that are kept in the switch. It does not apply to the external logging server.
|
Step 7
|
show logging timestamp
Example:
switch(config)# show logging timestamp
|
(Optional) Displays the logging time-stamp units configured.
|
Step 8
|
copy running-config startup-config
Example:
switch(config)# copy running-config startup-config
|
(Optional) Copies the running configuration to the startup configuration.
|
Configuring syslog Servers
You can configure up to eight syslog servers that reference remote systems where you want to log system messages.
Note We recommend that you configure the syslog server to use the management virtual routing and forwarding (VRF) instance. For more information on VRFs, see the Cisco Nexus 7000 Series NX-OS Unicast Routing Configuration Guide, Release 5.x.
BEFORE YOU BEGIN
Make sure that you are in the correct VDC. To change the VDC, use the
switchto vdc
command.
SUMMARY STEPS
1.
config t
2.
logging server
host
[
severity-level
[
use-vrf
vrf-name
]]
no logging server
host
3.
logging source-interface loopback
virtual-interface
4.
show logging server
5.
copy running-config startup-config
|
|
|
Step 1
|
config t
Example:
switch# config t
Enter configuration commands, one per line. End with CNTL/Z.
switch(config)#
|
Places you in global configuration mode.
|
Step 2
|
logging server
host
[
severity-level
[
use-vrf
vrf-name
]]
Example 1:
switch(config)# logging server 192.0.2.253
Example 2:
switch(config)# logging server 2001::)db*::3 5 use-vrf red
|
Configures a syslog server at the specified hostname or IPv4 or IPv6 address. You can limit logging of messages to a particular VRF by using the
use-vrf
keyword. In Cisco NX-OS Release 4.2 or higher, the default VRF is default. Severity levels, which range from 0 to 7, are listed in
Table 8-1
. The default outgoing facility is local7.
Example 1 forwards all messages on facility local 7.
Example 2 forwards messages with severity level 5 or lower for VRF red.
|
no logging server
host
Example:
switch(config)# no logging server host
|
Removes the logging server for the specified host.
|
Step 3
|
logging source-interface loopback
virtual-interface
Example:
switch(config)# logging source-interface loopback 5
|
Enables a source interface for the remote syslog server. The range for the
virtual-interface
argument is from 0 to 1023.
|
Step 4
|
show logging server
Example:
switch(config)# show logging server
|
(Optional) Displays the syslog server configuration.
|
Step 5
|
copy running-config startup-config
Example:
switch(config)# copy running-config startup-config
|
(Optional) Copies the running configuration to the startup configuration.
|
You 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> action
Table 8-3
describes the syslog fields that you can configure.
.
Table 8-3 syslog Fields in syslog.conf
|
|
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 hostname preceded by the at sign (@), a comma-separated list of users, or an asterisk (*) for all logged-in users.
|
To configure a syslog server on a UNIX or Linux system, follow these steps:
Step 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:
debug.local7 /var/log/myfile.log
Step 2 Create the log file by entering these commands at the shell prompt:
$ touch /var/log/myfile.log $ chmod 666 /var/log/myfile.log
Step 3 Make sure the system message logging daemon reads the new changes by checking myfile.log after entering this command:
$ kill -HUP ~cat /etc/syslog.pid~
Displaying and Clearing Log Files
You can display or clear messages in the log file and the NVRAM.
BEFORE YOU BEGIN
Make sure that you are in the correct VDC. To change the VDC, use the
switchto vdc
command.
SUMMARY STEPS
1.
show logging last
number-lines
2.
show logging logfile
[
start-time
yyyy mmm dd hh:mm:ss
] [
end-time
yyyy mmm dd hh:mm:ss
]
3.
show logging nvram
[
last
number-lines
]
4.
clear logging logfile
5.
clear logging nvram
|
|
|
Step 1
|
show logging last
number-lines
Example:
switch# show logging last 40
|
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
|
show logging logfile
[
start-time
yyyy
mmm dd hh:mm:ss
] [
end-time
yyyy mmm dd hh:mm:ss
]
Example:
switch# show logging logfile start-time 2007 nov 1 15:10:0
|
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
|
show logging nvram
[
last
number-lines
]
Example:
switch# show logging nvram last 10
|
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
|
clear logging logfile
Example:
switch# clear logging logfile
|
Clears the contents of the log file.
|
Step 5
|
clear logging nvram
Example:
switch# clear logging nvram
|
Clears the logged messages in NVRAM.
|