logging
To specify a system logging (syslog) server host as the recipient of syslog messages, use the logging command in XR Config 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 | vrf_name } } { archive | buffered | console | correlator | disable | events | facility | type | format rfc5424 | history | hostnameprefix | localfilesize | monitor | operator | port | severity | source-address | source-interface | ipv4 address | suppress | trap }
Syntax Description
ip-address | hostname |
IP address or hostname of the host to be used as a syslog server. |
vrf vrf-name |
Name of the VRF. Maximum length is 32 alphanumeric characters. |
archive |
Specifies logging to a persistent device(disk/harddisk). |
buffered |
Sets buffered logging parameters. |
console |
Sets console logging. |
correlator |
Configures properties of the event correlator |
disable |
Disables console logging. |
events |
Configures event monitoring parameters. |
facility type |
Modifies message logging facilities. |
format |
Configures the syslog message format to send to the server. |
rfc5424 |
Sets the syslog message format according to RFC 5424. |
history |
Sets history logging. |
hostnameprefix |
Adds the hostname prefix to messages on servers. |
localfilesize |
Sets size of the local log file. |
monitor |
Sets monitor logging |
operator | Sets severity operator of messages for anparticular remote host/vrf. |
port | Sets UDP port for this remote host/vrf. |
severity | Sets severity of messages for particular remote host/vrf |
source-address ipv4 address | Specifies source address of the logging host. |
source-interface |
Specifies interface for source address in logging transactions. |
suppress |
Configures properties for the event suppression. |
trap |
Sets trap logging. |
Command Default
No syslog server hosts are configured as recipients of syslog messages.
Command Modes
XR Config modeCommand History
Release |
Modification |
---|---|
Release 24.2.1 |
The facility and source-address options per remote syslog server were introduced. |
Release 7.0.12 |
This command was introduced. |
Usage Guidelines
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.
The configurations for facility and source-address per remote syslog server takes priority over global configuration.
Task ID
Task ID |
Operations |
---|---|
logging |
read, write |
This example shows how to log messages to a host named host1:
Router(config)#logging host1
Router(config)#logging A.B.C.D
facility Modify message logging facilities
operator Set severity operator of messages for particular remote host/vrf
port Set UDP port for this remote host/vrf
severity Set severity of messages for particular remote host/vrf
source-address Specify source address of the logging host
vrf Set VRF option
Router(config)#logging A.B.C.D
Router(config)#commit
Wed Nov 14 03:47:58.976 PST
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. |
Configuration Example for Facility and Source-address Per Remote Syslog Server
This example shows how to configure facility and source-address per remote syslog server:
Router#configure
Router(config)#
Router(config)#logging 209.165.201.1 source-address 209.165.201.2
Router(config)#logging 209.165.201.1 facility local2
Router(config)#commit