The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
This module describes the Cisco IOS XR software commands to configure system logging (syslog) for system monitoring on the router.
To use commands of this module, you must be in a user group associated with a task group that includes appropriate task IDs. If the user group assignment is preventing you from using any command, contact your AAA administrator for assistance.
For detailed information about logging concepts, configuration tasks, and examples, see the Implementing Logging Services module in the Cisco IOS XR System Monitoring Configuration Guide for the Cisco XR 12000 Series Router.
For alarm management and logging correlation commands, see the Alarm Management and Logging Correlation Commands module in the Cisco IOS XR System Monitoring Command Reference for the Cisco XR 12000 Series Router.
For detailed information about alarm and logging correlation concepts, configuration tasks, and examples, see the Implementing Alarm Logs and Logging Correlation module in the Cisco IOS XR System Monitoring Configuration Guide for the Cisco XR 12000 Series Router.
To specify the length of time that logs are maintained in the logging archive, use the archive-length command in logging archive configuration mode. To return to the default, use the no form of this command.
archive-length weeks
no archive-length
weeks |
Length of time (in weeks) that logs are maintained in the archive. Range is 0 to 4294967295. |
weeks: 4 weeks
Logging archive configuration
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the archive-length command to specify the maximum number of weeks that the archive logs are maintained in the archive. Any logs older than this number are automatically removed from the archive.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to set the log archival period to 6 weeks:
RP/0/0/CPU0:router(config)# logging archive RP/0/0/CPU0:router(config-logging-arch)# archive-length 6
To specify the amount of space allotted for syslogs on a device, use the archive-size command in logging archive configuration mode. To return to the default, use the no form of this command.
archive-size size
no archive-size
size |
Amount of space (in MB) allotted for syslogs. The range is 0 to 2047. |
size: 20 MB
Logging archive configuration
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the archive-length command to specify the maximum total size of the syslog archives on a storage device. If the size is exceeded, then the oldest file in the archive is deleted to make space for new logs.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to set the allotted space for syslogs to 50 MB:
RP/0/0/CPU0:router(config)# logging archive RP/0/0/CPU0:router(config-logging-arch)# archive-size 50
To clear system logging (syslog) messages from the logging buffer, use the clear logging command in EXEC mode.
clear logging
This command has no keywords or arguments.
None
Release |
Modification |
---|---|
Release 3.2 |
This command was supported. |
Release 3.7.0 |
Removed the internal keyword. |
Use the clear logging command to empty the contents of the logging buffer. When the logging buffer becomes full, new logged messages overwrite old messages.
Use the logging buffered command to specify the logging buffer as a destination for syslog messages, set the size of the logging buffer, and limit syslog messages sent to the logging buffer based on severity.
Use the show logging command to display syslog messages stored in the logging buffer.
Task ID |
Operations |
---|---|
logging |
execute |
This example shows how to clear the logging buffer:
RP/0/0/CPU0:router# clear logging
Clear logging buffer [confirm] [y/n] :y
Command |
Description |
---|---|
Specifies the logging buffer as a destination for syslog messages, sets the size of the logging buffer, and limits syslog messages sent to the logging buffer based on severity. |
|
Displays syslog messages stored in the logging buffer. |
To specify the device to be used for logging syslogs, use the device command in logging archive configuration mode. To return to the default, use the no form of this command.
device { disk0 | disk1 | harddisk }
no device
disk0 |
Uses disk0 as the archive device. |
disk1 |
Uses disk1 as the archive device. |
harddisk |
Uses the harddisk as the archive device. |
None
Logging archive configuration
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the device command to specify where syslogs are logged. The logs are created under the directory <device>/var/log. If the device is not configured, then all other logging archive configurations are rejected. Similarly, the configured device cannot be removed until the other logging archive configurations are removed.
It is recommended that the syslogs be archived to the harddisk because it has more capacity.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to specify disk1 as the device for logging syslog messages:
RP/0/0/CPU0:router(config)# logging archive RP/0/0/CPU0:router(config-logging-arch)# device disk1
To specify the maximum file size for a log file in the archive, use the file-size command in logging archive configuration mode. To return to the default, use the no form of this command.
file-size size
no file-size
size |
Maximum file size (in MB) for a log file in the logging archive. The range is 1 to 2047. |
size: 1 MB
Logging archive configuration
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the file-size command to specify the maximum file size that a single log file in the archive can grow to. Once this limit is reached, a new file is automatically created with an increasing serial number.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to set the maximum log file size to 10 MB:
RP/0/0/CPU0:router(config)# logging archive RP/0/0/CPU0:router(config-logging-arch)# file-size 10
To specify the collection period for logs, use the frequency command in logging archive configuration mode. To return to the default, use the no form of this command.
frequency { daily | weekly }
no frequency
daily |
Logs are collected daily. |
weekly |
Logs are collected weekly. |
Logs are collected daily.
Logging archive configuration
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the frequency command to specify if logs are collected daily or weekly.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to specify that logs are collected weekly instead of daily:
RP/0/0/CPU0:router(config)# logging archive RP/0/0/CPU0:router(config-logging-arch)# frequency weekly
To specify a system logging (syslog) server host as the recipient of syslog messages, use the logging command in Global Configuration mode. To remove the logging command from the configuration file and delete a syslog server from the list of syslog server hosts, use the no form of this command.
logging { ip-address | hostname } { vrf | | severity | [ alerts | critical | debugging | emergencies | error | info | notifications | warning ] }
no logging { ip-address | hostname } { vrf | | severity | [ alerts | critical | debugging | emergencies | error | info | notifications | warning ] }
ip-address | hostname |
IP address or hostname of the host to be used as a syslog server. |
severity |
Set severity of messages for particular remote host/vrf. |
alerts |
Specifies Immediate action needed |
critical |
Specifies Critical conditions |
debugging |
Specifies Debugging messages |
emergencies |
Specifies System is unusable |
error |
Specifies Error conditions |
info |
Specifies Informational messages |
notifications |
Specifies Normal but significant conditions |
warning |
Specifies Warning conditions |
vrf vrf-name |
Name of the VRF. Maximum length is 32 alphanumeric characters. |
No syslog server hosts are configured as recipients of syslog messages.
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Release 4.1.0 |
The vrf keyword was added. |
Release 4.3 |
The severity keyword was added. |
Use the logging command to identify a syslog server host to receive messages. By issuing this command more than once, you build a list of syslog servers that receive messages.
When syslog messages are sent to a syslog server, the Cisco IOS XR software includes a numerical message identifier in syslog messages. The message identifier is cumulative and sequential. The numerical identifier included in syslog messages sent to syslog servers provides a means to determine if any messages have been lost.
Use the logging trap command to limit the messages sent to snmp server.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to log messages to a host named host1:
RP/0/0/CPU0:router(config)# logging host1
RP/0/0/CPU0:router(config)#logging A.B.C.D
severity Set severity of messages for particular remote host/vrf
vrf Set VRF option
RP/0/0/CPU0:router(config)#logging A.B.C.D RP/0/0/CPU0:router(config)#commit Wed Nov 14 03:47:58.976 PST RP/0/0/CPU0:router(config)#do show run logging Wed Nov 14 03:48:10.816 PST logging A.B.C.D vrf default severity info
Note | Default level is severity info. |
Command |
Description |
---|---|
Limits the messages sent to snmp server. |
To configure attributes for archiving syslogs, use the logging archive command in Global Configuration mode. To exit the logging archive submode, use the no form of this command.
logging archive { archive-length | archive-size | device | file-size | frequency | severity }
no logging archive
None
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the logging archive command to configure attributes for archiving syslogs. This command enters logging archive configuration mode and allows you to configure the commands.
Note | The configuration attributes must be explicitly configured in order to use the logging archive feature. |
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to enter logging archive configuration mode and change the device to be used for logging syslogs to disk1:
RP/0/0/CPU0:router(config)# logging archive RP/0/0/CPU0:router(config-logging-arch)# device disk1
To specify the logging buffer as a destination for system logging (syslog) messages, use the logging buffered command in Global Configuration mode. To remove the logging buffered command from the configuration file and cancel the use of the buffer, use the no form of this command.
logging buffered { size | severity }
no logging buffered { size | severity }
size |
Size of the buffer, in bytes. Range is 307200 to 125000000 bytes. The default is 307200 bytes. |
severity |
Severity level of messages that display on the console. Possible severity levels and their respective system conditions are listed under Table 1in the “Usage Guidelines” section. The default is debugging. |
size: 307200 bytes
severity: debugging
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Release 4.0.0 |
The value of size argument is changed from 4096 to 307200. |
Use the logging buffered command to copy messages to the logging buffer. The logging buffer is circular, so newer messages overwrite older messages after the buffer is filled. This command is related to the show logging buffer command, which means that when you execute a logging buffered warnings command, it enables the logging for all the levels below the configured level, including log for LOG_ERR, LOG_CRIT, LOG_ALERT, LOG_EMERG, and LOG_WARNING messages. Use the logging buffer size to change the size of the buffer.
The value specified for the severity argument causes messages at that level and at numerically lower levels to be displayed on the console terminal. See Table 1for a list of the possible severity level keywords for the severity argument.
Level Keywords |
Level |
Description |
Syslog Definition |
---|---|---|---|
emergencies |
0 |
Unusable system |
LOG_EMERG |
alerts |
1 |
Need for immediate action |
LOG_ALERT |
critical |
2 |
Critical condition |
LOG_CRIT |
errors |
3 |
Error condition |
LOG_ERR |
warnings |
4 |
Warning condition |
LOG_WARNING |
notifications |
5 |
Normal but significant condition |
LOG_NOTICE |
informational |
6 |
Informational message only |
LOG_INFO |
debugging |
7 |
Debugging message |
LOG_DEBUG |
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to set the severity level of syslog messages logged to the buffer to notifications:
RP/0/0/CPU0:router(config)# logging buffered notifications
Command |
Description |
---|---|
Clears messages from the logging buffer. |
|
Displays syslog messages stored in the logging buffer. |
To enable logging of system logging (syslog) messages logged to the console by severity level, use the logging console command in Global Configuration mode. To return console logging to the default setting, use the no form of this command.
logging console { severity | disable }
no logging console
severity |
Severity level of messages logged to the console, including events of a higher severity level (numerically lower). The default is informational. Settings for the severity levels and their respective system conditions are listed in Table 1 under the “Usage Guidelines” section for the logging buffered command. |
disable |
Removes the logging console command from the configuration file and disables logging to the console terminal. |
By default, logging to the console is enabled.
severity: informational
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Release 3.3.0 |
Added the disable keyword. The command no logging console was changed to reset console logging to the default setting. |
Use the logging console command to prevent debugging messages from flooding your screen.
The logging console is for the console terminal. The value specified for the severity argument causes messages at that level and at numerically lower levels (higher severity levels) to be displayed on the console.
Use the logging console disable command to disable console logging completely.
Use the no logging console command to return the configuration to the default setting.
Use the show logging command to display syslog messages stored in the logging buffer.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to change the level of messages displayed on the console terminal to alerts (1), which means that alerts (1) and emergencies (0) are displayed:
RP/0/0/CPU0:router(config)# logging console alerts
This example shows how to disable console logging:
RP/0/0/CPU0:router(config)# logging console disable
This example shows how to return console logging to the default setting (the console is enabled, severity: informational):
RP/0/0/CPU0:router# no logging console
Command |
Description |
---|---|
Displays syslog messages stored in the logging buffer. |
To disable logging of system logging (syslog) messages logged to the console, use the logging console disable command in Global Configuration mode. To return logging to the default setting, use the no form of this command.
logging console disable
no logging console disable
This command has no keywords or arguments.
By default, logging is enabled.
Release |
Modification |
---|---|
Release 3.3.0 |
This command was introduced. |
Use the logging console disable command to disable console logging completely.
Use the no logging console disable command to return the configuration to the default setting.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to disable syslog messages:
RP/0/0/CPU0:router(config)# logging console disable
To enable the logging of link-status system logging (syslog) messages for logical and physical links, use the logging events link-status command in Global Configuration mode. To disable the logging of link status messages, use the no form of this command.
logging events link-status { disable | software-interfaces }
no logging events link-status [ disable | software-interfaces ]
disable |
Disables the logging of link-status messages for all interfaces, including physical links. |
software-interfaces |
Enables the logging of link-status messages for logical links as well as physical links. |
The logging of link-status messages is enabled for physical links.
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Release 3.5.0 |
The logical and physical keywords were replaced by the software-interfaces and disable keywords. |
When the logging of link-status messages is enabled, the router can generate a high volume of link-status up and down system logging messages.
Use the no logging events link-status command to enable the logging of link-status messages for physical links only, which is the default behavior.
Note | Enabling the logging events link-status (interface) command on a specific interface overrides the global configuration set using the logging events link-status command described in this section. |
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to disable the logging of physical and logical link-status messages:
RP/0/0/CPU0:router(config)# logging events link-status disable
Command |
Description |
---|---|
Enables the logging of link-status system logging (syslog) messages on a specific interface for virtual interfaces and subinterfaces. |
To enable the logging of link-status system logging (syslog) messages on a specific interface for virtual interfaces and subinterfaces, use the logging events link-status command in the appropriate interface or subinterface mode. To disable the logging of link status messages, use the no form of this command.
logging events link-status
no logging events link-status
This command has no keywords or arguments.
The logging of link-status messages is disabled for virtual interfaces and subinterfaces.
Interface configuration
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
When the logging of link-status messages is enabled, the router can generate a high volume of link-status up and down system logging messages. The logging events link-status command enables messages for virtual interfaces and subinterfaces only.
The logging events link-status command allows you to enable and disable logging on a specific interface for bundles, tunnels, and VLANs.
Use the no logging events link-status command to disable the logging of link-status messages.
Note | Enabling the logging events link-status command on a specific interface overrides the global configuration set using the logging events link-status command in global configuration mode. |
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows the results of turning on logging for a bundle interface:
RP/0/0/CPU0:router(config)# int bundle-pos 1 RP/0/0/CPU0:router(config-if)# logging events link-status RP/0/0/CPU0:router(config-if)# no shutdown RP/0/0/CPU0:router(config-if)# commit LC/0/4/CPU0:Jun 29 12:51:26.887 : ifmgr[142]: %PKT_INFRA-LINK-3-UPDOWN : Interface POS0/4/0/0, changed state to Up LC/0/4/CPU0:Jun 29 12:51:26.897 : ifmgr[142]: %PKT_INFRA-LINEPROTO-6-UPDOWN : Line protocol on Interface POS0/4/0/0, changed state to Up RP/0/0/CPU0:router(config-if)# RP/0/0/CPU0:router(config-if)# shutdown RP/0/0/CPU0:router(config-if)# commit LC/0/4/CPU0:Jun 29 12:51:32.375 : ifmgr[142]: %PKT_INFRA-LINK-3-UPDOWN : Interface POS0/4/0/0, changed state to Down LC/0/4/CPU0:Jun 29 12:51:32.376 : ifmgr[142]: %PKT_INFRA-LINEPROTO-6-UPDOWN : Line protocol on Interface POS0/4/0/0, changed state to Down
This example shows a sequence of commands for a tunnel interface with and without logging turned on:
RP/0/0/CPU0:router(config)# int tunnel-te 1 RP/0/0/CPU0:router(config-if)# commit RP/0/0/CPU0:router(config-if)# shutdown RP/0/0/CPU0:router(config-if)# commit RP/0/0/CPU0:router(config-if)# no shutdown RP/0/0/CPU0:router(config-if)# commit RP/0/0/CPU0:router(config-if)# logging events link-status RP/0/0/CPU0:router(config-if)# commit RP/0/0/CPU0:router(config-if)# shutdown RP/0/0/CPU0:router(config-if)# commit RP/0/0/CPU0:Jun 29 14:05:57.732 : ifmgr[176]: %PKT_INFRA-LINK-3-UPDOWN : Interface tunnel-te1, changed state to Administratively Down RP/0/0/CPU0:Jun 29 14:05:57.733 : ifmgr[176]: %PKT_INFRA-LINEPROTO-6-UPDOWN : Line protocol on Interface tunnel-te1, changed state to Administratively Down RP/0/0/CPU0:router(config-if)# no shutdown RP/0/0/CPU0:router(config-if)# commit RP/0/0/CPU0:Jun 29 14:06:02.104 : ifmgr[176]: %PKT_INFRA-LINK-3-UPDOWN : Interface tunnel-te1, changed state to Down RP/0/0/CPU0:Jun 29 14:06:02.109 : ifmgr[176]: %PKT_INFRA-LINEPROTO-6-UPDOWN : Line protocol on Interface tunnel-te1, changed state to Down
This example shows the same process for a subinterface:
RP/0/0/CPU0:router(config)# int gigabitEthernet 0/5/0/0.1 RP/0/0/CPU0:router(config-subif)# commit RP/0/0/CPU0:router(config-subif)# shutdown RP/0/0/CPU0:router(config-subif)# commit RP/0/0/CPU0:router(config-subif)# no shutdown RP/0/0/CPU0:router(config-subif)# commit RP/0/0/CPU0:router(config-subif)# logging events link-status RP/0/0/CPU0:router(config-subif)# commit RP/0/0/CPU0:router(config-subif)# shutdown RP/0/0/CPU0:router(config-subif)# commit LC/0/5/CPU0:Jun 29 14:06:46.710 : ifmgr[142]: %PKT_INFRA-LINEPROTO-6-UPDOWN : Line protocol on Interface GigabitEthernet0/5/0/0.1, changed state to Administratively Down LC/0/5/CPU0:Jun 29 14:06:46.726 : ifmgr[142]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/5/0/0.1, changed state to Administratively Down RP/0/0/CPU0:router(config-subif)# no shutdown RP/0/0/CPU0:router(config-subif)# commit LC/0/5/CPU0:Jun 29 14:06:52.229 : ifmgr[142]: %PKT_INFRA-LINK-3-UPDOWN : Interface GigabitEthernet0/5/0/0.1, changed state to Up LC/0/5/CPU0:Jun 29 14:06:52.244 : ifmgr[142]: %PKT_INFRA-LINEPROTO-6-UPDOWN : Line protocol on Interface GigabitEthernet0/5/0/0.1, changed state to Down
To configure the type of syslog facility in which system logging (syslog) messages are sent to syslog servers, use the logging facility command in Global Configuration mode. To remove the logging facility command from the configuration file and disable the logging of messages to any facility type, use the no form of this command.
logging facility [type]
no logging facility
type |
(Optional) Syslog facility type. The default is local7. Possible values are listed under Table 1in the “Usage Guidelines” section. |
type: local7
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
This table describes the acceptable options for the type argument.
Facility Type |
Description |
---|---|
auth |
Authorization system |
cron |
Cron/at facility |
daemon |
System daemon |
kern |
Kernel |
local0 |
Reserved for locally defined messages |
local1 |
Reserved for locally defined messages |
local2 |
Reserved for locally defined messages |
local3 |
Reserved for locally defined messages |
local4 |
Reserved for locally defined messages |
local5 |
Reserved for locally defined messages |
local6 |
Reserved for locally defined messages |
local7 |
Reserved for locally defined messages |
lpr |
Line printer system |
|
Mail system |
news |
USENET news |
sys9 |
System use |
sys10 |
System use |
sys11 |
System use |
sys12 |
System use |
sys13 |
System use |
sys14 |
System use |
syslog |
System log |
user |
User process |
uucp |
UNIX-to-UNIX copy system |
Use the logging command to specify a syslog server host as a destination for syslog messages.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to configure the syslog facility to the kern facility type:
RP/0/0/CPU0:router(config)# logging facility kern
Command |
Description |
---|---|
Specifies a syslog server host as a destination for syslog messages. |
To change the severity level of system logging (syslog) messages sent to the history table on the router and a Simple Network Management Protocol (SNMP) network management station (NMS), use the logging history command in Global Configuration mode. To remove the logging history command from the configuration and return the logging of messages to the default level, use the no form of this command.
logging history severity
no logging history
severity |
Severity level of messages sent to the history table on the router and an SNMP NMS, including events of a higher severity level (numerically lower). Settings for the severity levels and their respective system conditions are listed in Table 1 under the “Usage Guidelines” section for the logging buffered command. |
severity: warnings
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Logging of messages to an SNMP NMS is enabled by the snmp-server enable traps command. Because SNMP traps are inherently unreliable and much too important to lose, at least one syslog message, the most recent message, is stored in a history table on the router.
Use the logging history command to reflect the history of last 500 syslog messages. For example, when this command is issued, the last 500 syslog messages with severity less than warning message are displayed in the output of show logging history command.
Use the show logging history command to display the history table, which contains table size, message status, and message text data.
Use the logging history size command to change the number of messages stored in the history table.
The value specified for the severity argument causes messages at that severity level and at numerically lower levels to be stored in the history table of the router and sent to the SNMP NMS. Severity levels are numbered 0 to 7, with 1 being the most important message and 7 being the least important message (that is, the lower the number, the more critical the message). For example, specifying the level critical with the critical keyword causes messages at the severity level of critical (2), alerts (1), and emergencies (0) to be stored in the history table and sent to the SNMP NMS.
The no logging history command resets the history level to the default.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to change the level of messages sent to the history table and to the SNMP server to alerts (1), which means that messages at the severity level of alerts (1) and emergencies (0) are sent:
RP/0/0/CPU0:router(config)# logging history alerts
Command |
Description |
---|---|
Changes the number of messages stored in the history table. |
|
Displays information about the state of the syslog history table. |
To change the number of system logging (syslog) messages that can be stored in the history table, use the logging history size command in Global Configuration mode. To remove the logging history size command from the configuration and return the number of messages to the default value, use the no form of this command.
logging history size number
no logging history number
number |
Number from 1 to 500 indicating the maximum number of messages that can be stored in the history table. The default is 1 message. |
number: 1 message
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the logging history size command to change the number of messages that can be stored in this history table. When the history table is full (that is, when it contains the maximum number of messages specified with the command), the oldest message is deleted from the table to allow the new message to be stored.
Use the logging history command to change the severity level of syslog messages stored in the history file and sent to the SNMP server.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to set the number of messages stored in the history table to 20:
RP/0/0/CPU0:router(config)# logging history size 20
Command |
Description |
---|---|
Changes the severity level of syslog messages stored in the history file and sent to the SNMP server. |
|
Displays information about the state of the syslog history table. |
To append a hostname prefix to system logging (syslog) messages logged to syslog servers, use the logging hostnameprefix command in Global Configuration mode. To remove the logging hostnameprefix command from the configuration file and disable the logging host name prefix definition, use the no form of this command.
logging hostnameprefix hostname
no logging hostnameprefix
hostname |
Hostname that appears in messages sent to syslog servers. |
No hostname prefix is added to the messages logged to the syslog servers.
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the logging hostnameprefix command to append a hostname prefix to messages sent to syslog servers from the router. You can use these prefixes to sort the messages being sent to a given syslog server from different networking devices.
Use the logging command to specify a syslog server host as a destination for syslog messages.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to add the hostname prefix host1 to messages sent to the syslog servers from the router:
RP/0/0/CPU0:router(config)# logging hostnameprefix host1
Command |
Description |
---|---|
Specifies a syslog server host as a destination for syslog messages. |
To configure the differentiated services code point (DSCP) or the precedence value for the IPv4 or IPv6 header of the syslog packet in the egress direction, use the logging {ipv4 | ipv6} command in EXEC mode. To remove the configured DSCP or precedence value, use the no form of this command.
logging { ipv4 | ipv6 } { dscp dscp-value | precedence { number | name } }
no logging { ipv4 | ipv6 } { dscp dscp-value | precedence { number | name } }
None.
Release | Modification |
---|---|
Release 5.1.1 |
The ipv4 and ipv6 keywords were added. |
By specifying PHB values you can further control the format of locally generated syslog traffic on the network.
af11—Match packets with AF11 DSCP (001010)
af12—Match packets with AF12 dscp (001100)
af13—Match packets with AF13 dscp (001110)
af21— Match packets with AF21 dscp (010010)
af22—Match packets with AF22 dscp (010100)
af23—Match packets with AF23 dscp (010110)
af31—Match packets with AF31 dscp (011010)
af32—Match packets with AF32 dscp (011100)
af33—Match packets with AF33 dscp (011110)
af41—Match packets with AF41 dscp (100010)
af42—Match packets with AF42 dscp (100100)
af43— Match packets with AF43 dscp (100110)
cs1—Match packets with CS1(precedence 1) dscp (001000)
cs2—Match packets with CS2(precedence 2) dscp (010000)
cs3—Match packets with CS3(precedence 3) dscp (011000)
cs4—Match packets with CS4(precedence 4) dscp (100000)
cs5—Match packets with CS5(precedence 5) dscp (101000)
cs6—Match packets with CS6(precedence 6) dscp (110000)
cs7—Match packets with CS7(precedence 7) dscp (111000)
default—Match packets with default dscp (000000)
ef—Match packets with EF dscp (10111)
Assured Forwarding (AF) PHB group is a means for a provider DS domain to offer different levels of forwarding assurances for IP packets. The Assured Forwarding PHB guarantees an assured amount of bandwidth to an AF class and allows access to additional bandwidth, if obtainable.
For example AF PHB value af11 - Match packets with AF11 DSCP (001010), displays the DSCP values as 10 and 11. The DSCP bits are shown as 001010 and 001011 .
AF11 stands for:
Similarly AF PHB value af12 - Match packets with AF12 dscp (001100), displays the DSCP values as 12 and 13. The DSCP bits are shown as 001100 and 001101.
AF12 stands for:
Class Selector (CS) provides backward compatibility bits,
CS PHB value cs1 - Match packets with CS1(precedence 1) dscp (001000)
CS1 stands for:
Expedited Forwarding (EF) PHB is defined as a forwarding treatment to build a low loss, low latency, assured bandwidth, end-to-end service. These characteristics are suitable for voice, video and other realtime services.
EF PHB Value ef - Match packets with EF dscp (101110) - this example states the recommended EF value (used for voice traffic).
Task ID | Operation |
---|---|
logging |
read, write |
RP/0/0/CPU0:router(config)#logging ipv4 dscp 1
RP/0/0/CPU0:router(config)#logging ipv6 dscp 21
RP/0/0/CPU0:router(config)#logging ipv6 precedence 5
To specify the size of the local logging file, use the logging localfilesize command in Global Configuration mode. To remove the logging localfilesize command from the configuration file and restore the system to the default condition, use the no form of this command.
logging localfilesize bytes
no logging localfilesize bytes
bytes |
Size of the local logging file in bytes. Range is 0 to 4294967295. Default is 32000 bytes. |
bytes: 32000 bytes
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the logging localfilesize command to set the size of the local logging file.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to set the local logging file to 90000 bytes:
RP/0/0/CPU0:router(config)# logging localfilesize 90000
Command |
Description |
---|---|
Displays syslog messages stored in the logging buffer. |
To specify terminal lines other than the console terminal as destinations for system logging (syslog) messages and limit the number of messages sent to terminal lines based on severity, use the logging monitor command in Global Configuration mode. To remove the logging monitor command from the configuration file and disable logging to terminal lines other than the console line, use the no form of this command.
logging monitor [severity]
no logging monitor
severity |
(Optional) Severity level of messages logged to the terminal lines, including events of a higher severity level (numerically lower). The default is debugging. Settings for the severity levels and their respective system conditions are listed under Table 1 in the “Usage Guidelines” section for the logging buffered command. |
severity: debugging
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
The logging monitor is for the terminal monitoring. Use the logging monitor command to restrict the messages displayed on terminal lines other than the console line (such as virtual terminals). The value set for the severity argument causes messages at that level and at numerically lower levels to be displayed on the monitor.
Use the terminal monitor command to enable the display of syslog messages for the current terminal session.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to set the severity level of messages logged to terminal lines to errors:
RP/0/0/CPU0:router(config)# logging monitor errors
Command |
Description |
---|---|
Enables the display of syslog messages for the current terminal session. |
To set all system logging (syslog) messages being sent to syslog servers to contain the same IP address, regardless of which interface the syslog message uses to exit the router, use the logging source-interface command in Global Configuration mode. To remove the logging source-interface command from the configuration file and remove the source designation, use the no form of this command.
logging source-interface type interface-path-id
no logging source-interface
type |
Interface type. For more information, use the question mark (?) online help function. |
||
interface-path-id |
Physical interface or virtual interface.
For more information about the syntax for the router, use the question mark (?) online help function. |
No source IP address is specified.
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Normally, a syslog message contains the IP address of the interface it uses to leave the networking device. Use the logging source-interface command to specify that syslog packets contain the IP address of a particular interface, regardless of which interface the packet uses to exit the networking device.
Use the logging command to specify a syslog server host as a destination for syslog messages.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to specify that the IP address for Packet-over-SONET/SDH (POS) interface 0/1/0/1 be set as the source IP address for all messages:
RP/0/0/CPU0:router(config)# logging source-interface pos 0/1/0/1
Command |
Description |
---|---|
Specifies a syslog server host as a destination for syslog messages. |
To prevent the logging of messages to the console to indicate that commands are deprecated, use the logging suppress deprecated command in Global Configuration mode. To remove the logging suppress deprecated command from the configuration file, use the no form of this command.
logging suppress deprecated
no logging suppress deprecated
This command has no keywords or arguments.
Console messages are displayed when deprecated commands are used.
Release |
Modification |
---|---|
Release 3.5.0 |
This command was introduced. |
The logging suppress deprecated command affects messages to the console only.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to suppress the consecutive logging of deprecated messages:
RP/0/0/CPU0:router(config)# logging suppress deprecated
To prevent the consecutive logging of more than one copy of the same system logging (syslog) message, use the logging suppress duplicates command in Global Configuration mode. To remove the logging suppress duplicates command from the configuration file and disable the filtering process, use the no form of this command.
logging suppress duplicates
no logging suppress duplicates
This command has no keywords or arguments.
Duplicate messages are logged.
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
If you use the logging suppress duplicates command during debugging sessions, you might not see all the repeated messages and could miss important information related to problems that you are attempting to isolate and resolve. In such a situation, you might consider disabling this command.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to suppress the consecutive logging of duplicate messages:
RP/0/0/CPU0:router(config)# logging suppress duplicates
Command |
Description |
---|---|
Specifies a syslog server host as a destination for syslog messages. |
|
Specifies the logging buffer as a destination for syslog messages, sets the size of the logging buffer, and limits the syslog messages sent to the logging buffer based on severity. |
|
Specifies terminal lines other than the console terminal as destinations for syslog messages and limits the number of messages sent to terminal lines based on severity. |
To specify the severity level of messages logged to snmp server, use the logging trap command in Global Configuration mode. To restore the default behavior, use the no form of this command.
logging trap [severity]
no logging trap
severity |
(Optional) Severity level of messages logged to the snmp server, including events of a higher severity level (numerically lower). The default is informational. Settings for the severity levels and their respective system conditions are listed under Table 1 in the “Usage Guidelines” section for the logging buffered command. |
severity: informational
Release |
Modification |
---|---|
Release 3.7.2 |
This command was introduced. |
Release 4.3 |
Change in the behavior of logging trap and logging severity for snmp and syslog servers. |
Use the logging trap command to limit the logging of messages sent to snmp servers to only those messages at the specified level.
Table 1 under the “Usage Guidelines” section for the logging buffered command lists the syslog definitions that correspond to the debugging message levels.
Use the logging command to specify a syslog server host as a destination for syslog messages.
The logging trap disable will disable the logging of messages to both snmp server and syslog servers.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to restrict messages to notifications (5) and numerically lower levels.
RP/0/0/CPU0:router(config)# logging trap notifications
Command |
Description |
---|---|
Specifies a syslog server host as a destination for syslog messages. |
To modify the time-stamp format for system logging (syslog) and debug messages, use the service timestamps command in Global Configuration mode. To revert to the default timestamp format, use the no form of this command.
service timestamps [ [ debug | log ] { datetime [localtime] [msec] [show-timezone] [year] | disable | uptime } ]
no service timestamps [ [ debug | log ] { datetime [localtime] [msec] [show-timezone] [year] | disable | uptime } ]
debug |
(Optional) Specifies the time-stamp format for debugging messages. |
log |
(Optional) Specifies the time-stamp format for syslog messages. |
datetime |
(Optional) Specifies that syslog messages are time-stamped with date and time. |
localtime |
(Optional) When used with the datetime keyword, includes the local time zone in time stamps. |
msec |
(Optional) When used with the datetime keyword, includes milliseconds in the time stamp. |
show-timezone |
(Optional) When used with the datetime keyword, includes time zone information in the time stamp. |
year |
(Optional) Adds year information to timestamp. |
disable |
(Optional) Causes messages to be time-stamped in the default format. |
uptime |
(Optional) Specifies that syslog messages are time-stamped with the time that has elapsed since the networking device last rebooted. |
Messages are time-stamped in the month day hh:mm:ss by default.
The default for the service timestamps debug datetime and service timestamps log datetime forms of the command with no additional keywords is to format the time in Coordinated Universal Time (UTC) without milliseconds and time zone information.
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Release 4.3 |
The keyword year was added. |
Time stamps can be added to either debugging or syslog messages independently. The uptime keyword adds time stamps in the format hhhh:mm:ss, indicating the elapsed time in hours:minutes:seconds since the networking device last rebooted. The datetime keyword adds time stamps in the format mmm dd hh:mm:ss, indicating the date and time according to the system clock. If the system clock has not been set, the date and time are preceded by an asterisk (*), which indicates that the date and time have not been set and should be verified.
The no form of the service timestamps command causes messages to be time-stamped in the default format.
Entering the service timestamps form of this command without any keywords or arguments is equivalent to issuing the service timestamps debug uptime form of this command.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to enable time stamps on debugging messages, which show the elapsed time since the networking device last rebooted:
RP/0/0/CPU0:router(config)# service timestamps debug uptime
This example shows how to enable time stamps on syslog messages, which show the current time and date relative to the local time zone, with the time zone name included:
RP/0/0/CPU0:router(config)# service timestamps log datetime localtime show-timezone
RP/0/0/CPU0:router(config)# service timestamps log datetime year
To specify the filter level for logs, use the severity command in logging archive configuration mode. To return to the default, use the no form of this command.
severity { severity }
no severity
severity |
Severity level for determining which messages are logged to the archive. Possible severity levels and their respective system conditions are listed under Table 1 in the “Usage Guidelines” section. The default is informational. |
Informational
Logging archive configuration
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the severity command to specify the filter level for syslog messages. All syslog messages higher in severity or the same as the configured value are logged to the archive.
Table 1 describes the acceptable severity levels for the severity argument.
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to specify that warning conditions and higher-severity messages are logged to the archive:
RP/0/0/CPU0:router(config)# logging archive RP/0/0/CPU0:router(config-logging-arch)# severity warnings
To display the contents of the logging buffer, use the show logging command in EXEC mode.
show logging [ local location node-id | [ location node-id ] [ start month day hh : mm : ss ] [ process name ] [ string string ] [ end month day hh : mm :ss ] ]
None
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the show logging command to display the state of syslog error and event logging on the processor console. The information from the command includes the types of logging enabled and the size of the buffer.
Task ID |
Operations |
---|---|
logging |
read |
This is the sample output from the show logging command with the process keyword and name argument. Syslog messages related to the init process are displayed in the sample output.
RP/0/0/CPU0:router# show logging process init
Syslog logging: enabled (24 messages dropped, 0 flushes, 0 overruns)
Console logging: level , 59 messages logged
Monitor logging: level debugging, 0 messages logged
Trap logging: level informational, 0 messages logged
Buffer logging: level debugging, 75 messages logged
Log Buffer (16384 bytes):
LC/0/1/CPU0:May 24 22:20:13.043 : init[65540]: %INIT-7-INSTALL_READY : total time 47.522 seconds
SP/0/1/SP:May 24 22:18:54.925 : init[65541]: %INIT-7-MBI_STARTED : total time 7.159 seconds
SP/0/1/SP:May 24 22:20:16.737 : init[65541]: %INIT-7-INSTALL_READY : total time 88.984 seconds
SP/0/SM1/SP:May 24 22:18:40.993 : init[65541]: %INIT-7-MBI_STARTED : total time 7.194 seconds
SP/0/SM1/SP:May 24 22:20:17.195 : init[65541]: %INIT-7-INSTALL_READY : total time 103.415 seconds
SP/0/2/SP:May 24 22:18:55.946 : init[65541]: %INIT-7-MBI_STARTED : total time 7.152 seconds
SP/0/2/SP:May 24 22:20:18.252 : init[65541]: %INIT-7-INSTALL_READY : total time 89.473 seconds
This is the sample output from the show logging command using both the processname keyword argument pair and location node-id keyword argument pair. Syslog messages related to the “init” process emitted from node 0/1/CPU0 are displayed in the sample output.
RP/0/0/CPU0:router# show logging process init location 0/1/CPU0
Syslog logging: enabled (24 messages dropped, 0 flushes, 0 overruns)
Console logging: level , 59 messages logged
Monitor logging: level debugging, 0 messages logged
Trap logging: level informational, 0 messages logged
Buffer logging: level debugging, 75 messages logged
Log Buffer (16384 bytes):
LC/0/1/CPU0:May 24 22:20:13.043 : init[65540]: %INIT-7-INSTALL_READY : total time 47.522 seconds
Field |
Description |
---|---|
Syslog logging |
If enabled, system logging messages are sent to a UNIX host that acts as a syslog server; that is, the host captures and saves the messages. |
Console logging |
If enabled, the level and the number of messages logged to the console are stated; otherwise, this field displays “disabled.” |
Monitor logging |
If enabled, the minimum level of severity required for a log message to be sent to the monitor terminal (not the console) and the number of messages logged to the monitor terminal are stated; otherwise, this field displays “disabled.” |
Trap logging |
If enabled, the minimum level of severity required for a log message to be sent to the syslog server and the number of messages logged to the syslog server are stated; otherwise, this field displays “disabled.” |
Buffer logging |
If enabled, the level and the number of messages logged to the buffer are stated; otherwise, this field displays “disabled.” |
Command |
Description |
---|---|
Clears messages from the logging buffer. |
To display information about the state of the system logging (syslog) history table, use the show logging history command in EXEC mode mode.
show logging history
This command has no keywords or arguments.
None
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the show logging history command to display information about the syslog history table, such as the table size, the status of messages, and the text of messages stored in the table. Simple Network Management Protocol (SNMP) configuration parameters and protocol activity also are displayed.
Use the logging history command to change the severity level of syslog messages stored in the history file and sent to the SNMP server.
Use the logging history size to change the number of syslog messages that can be stored in the history table.
Task ID |
Operations |
---|---|
logging |
read |
This is the sample output from the show logging history command:
RP/0/0/CPU0:router# show logging history
Syslog History Table: '1' maximum table entries
saving level 'warnings' or higher
137 messages ignored, 0 dropped, 29 table entries flushed
SNMP notifications disabled
Field |
Description |
---|---|
maximum table entries |
Number of messages that can be stored in the history table. Set with the logging history size command. |
saving level |
Level of messages that are stored in the history table and sent to the SNMP server (if SNMP notifications are enabled). Set with the logging history command. |
messages ignored |
Number of messages not stored in the history table because the severity level is greater than that specified with the logging history command. |
SNMP notifications |
Status of whether syslog traps of the appropriate level are sent to the SNMP server. Syslog traps are either enabled or disabled through the snmp-server enable command. |
Command |
Description |
---|---|
Changes the severity level of syslog messages stored in the history file and sent to the SNMP server. |
|
Changes the number of syslog messages that can be stored in the history table. |
To enable the display of debug command output and system logging (syslog) messages for the current terminal session, use the terminal monitor command in EXEC mode.
terminal monitor [disable]
disable |
(Optional) Disables the display of syslog messages for the current terminal session. |
None
Release |
Modification |
---|---|
Release 3.2 |
This command was introduced. |
Use the terminal monitor command to enable the display of syslog messages for the current terminal session.
Note | Syslog messages are not sent to terminal lines unless the logging monitor is enabled. |
Use the terminal monitor disable command to disable the display of logging messages for the current terminal session. If the display of logging messages has been disabled, use the terminal monitor command to re-enable the display of logging messages for the current terminal session.
The terminal monitor command is set locally, and does not remain in effect after a terminal session has ended; therefore, you must explicitly enable or disable the terminal monitor command each time that you would like to monitor a terminal session.
Task ID |
Operations |
---|---|
logging |
execute |
This example shows how to enable the display syslog messages for the current terminal session:
RP/0/0/CPU0:router# terminal monitor
Command |
Description |
---|---|
Specifies terminal lines other than console terminal as destinations for syslog messages and limits the number of messages sent to terminal lines based on severity. |