Logging
Configure logging settings on IOS-XR devices to control how system messages are handled, including destination configuration, severity levels, message formatting, source interface configuration, archive settings, file logging, suppress rules, and more.
Diagram
Section titled “Diagram”Classes
Section titled “Classes”configuration (iosxr.devices)
Section titled “configuration (iosxr.devices)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| logging | Class | [logging] | No |
logging (iosxr.devices.configuration)
Section titled “logging (iosxr.devices.configuration)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| archive | Class | [archive] | No | |
| buffered | Class | [buffered] | No | |
| console | Choice | alerts, critical, debugging, disable, emergencies, errors, informational, notifications, warning | No | |
| console_facility | Choice | all | No | |
| container_all | Boolean | true, false | No | |
| container_fetch_timestamp | Boolean | true, false | No | |
| events | Class | [events] | No | |
| facility_level | Choice | all, audit, auth, authpriv, console, daemon, kern, local0, local1, local2, local3, local4, local5, local6, local7, mail, ntp, syslog, user | No | |
| files | List | [files] | No | |
| format | Choice | bsd, rfc5424 | No | |
| history | Choice | alerts, critical, debugging, disable, emergencies, errors, informational, notifications, warnings | No | |
| hosts | List | [hosts] | No | |
| history_size | Integer | min: 1, max: 500 | No | |
| hostnameprefix | String | No | ||
| ipv4_dscp | Any | Integer[min: 0, max: 63] or Choice[af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs1, cs2, cs3, cs4, cs5, cs6, cs7, default, ef] or String[Regex: ^.*[\$\%]\{.*$] | No | |
| ipv4_precedence | Any | Integer[min: 0, max: 7] or Choice[critical, flash, flash-override, immediate, internet, network, priority, routine] or String[Regex: ^.*[\$\%]\{.*$] | No | |
| ipv6_dscp | Any | Integer[min: 0, max: 63] or Choice[af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs1, cs2, cs3, cs4, cs5, cs6, cs7, default, ef] or String[Regex: ^.*[\$\%]\{.*$] | No | |
| ipv6_precedence | Any | Integer[min: 0, max: 7] or Choice[critical, flash, flash-override, immediate, internet, network, priority, routine] or String[Regex: ^.*[\$\%]\{.*$] | No | |
| localfilesize | Integer | min: 0, max: 4294967295 | No | |
| monitor | Class | [monitor] | No | |
| source_interfaces | List | [source_interfaces] | No | |
| suppress_duplicates | Boolean | true, false | No | |
| suppress_rules | List | [suppress_rules] | No | |
| trap | Choice | alerts, critical, debugging, disable, emergencies, errors, informational, notifications, warning | No | |
| yang | Choice | alerts, critical, debugging, emergencies, errors, informational, notifications, warnings | No |
archive (iosxr.devices.configuration.logging)
Section titled “archive (iosxr.devices.configuration.logging)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| device | Choice | disk0, disk1, harddisk | Yes | |
| filesize | Integer | min: 1, max: 2047 | No | |
| frequency | Choice | daily, weekly | No | |
| length | Integer | min: 1, max: 256 | No | |
| severity | Choice | alerts, critical, debugging, emergencies, errors, informational, notifications, warnings | No | |
| size | Integer | min: 1, max: 2047 | No | |
| threshold | Integer | min: 1, max: 99 | No |
buffered (iosxr.devices.configuration.logging)
Section titled “buffered (iosxr.devices.configuration.logging)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| discriminator_match1 | String | No | ||
| discriminator_match2 | String | No | ||
| discriminator_match3 | String | No | ||
| discriminator_nomatch1 | String | No | ||
| discriminator_nomatch2 | String | No | ||
| discriminator_nomatch3 | String | No | ||
| entries_count | Integer | min: 2545, max: 151699 | No | |
| level | Choice | alerts, critical, debugging, emergencies, errors, informational, notifications, warnings | No | |
| size | Integer | min: 307200, max: 125000000 | No |
events (iosxr.devices.configuration.logging)
Section titled “events (iosxr.devices.configuration.logging)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| buffer_size | Integer | min: 1024, max: 1024000 | No | |
| display_location | Boolean | true, false | No | |
| filter_matches | List | [filter_matches] | No | |
| level | Choice | alerts, critical, emergencies, errors, informational, notifications, warnings | No | |
| precfg_suppression | Choice | enable | No | |
| precfg_suppression_timeout | Integer | min: 1, max: 60 | No | |
| threshold | Integer | min: 10, max: 100 | No |
files (iosxr.devices.configuration.logging)
Section titled “files (iosxr.devices.configuration.logging)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| name | String | Yes | ||
| accounting_remote_facility | Choice | auth, cron, daemon, kern, local0, local1, local2, local3, local4, local5, local6, local7, lpr, mail, news, sys10, sys11, sys12, sys13, sys14, sys9, syslog, user, uucp | No | |
| discriminator_match1 | String | No | ||
| discriminator_match2 | String | No | ||
| discriminator_match3 | String | No | ||
| discriminator_nomatch1 | String | No | ||
| discriminator_nomatch2 | String | No | ||
| discriminator_nomatch3 | String | No | ||
| maxfilesize | Integer | min: 1, max: 2097152 | No | |
| path | String | No | ||
| severity | Choice | alerts, critical, debugging, emergencies, error, info, notifications, warning | No |
hosts (iosxr.devices.configuration.logging)
Section titled “hosts (iosxr.devices.configuration.logging)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| address | String | Yes | ||
| vrf | String | Yes | ||
| severity | Choice | alerts, critical, debugging, emergencies, error, info, notifications, warning | No | |
| port | Integer | min: 0, max: 65535 | No | |
| operator | Choice | equals, equals-or-higher, not-equals | No | |
| facility | Choice | all, audit, auth, authpriv, console, daemon, kern, local0, local1, local2, local3, local4, local5, local6, local7, mail, ntp, syslog, user | No | |
| source_address | String | No |
monitor (iosxr.devices.configuration.logging)
Section titled “monitor (iosxr.devices.configuration.logging)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| discriminator_match1 | String | No | ||
| discriminator_match2 | String | No | ||
| discriminator_match3 | String | No | ||
| discriminator_nomatch1 | String | No | ||
| discriminator_nomatch2 | String | No | ||
| discriminator_nomatch3 | String | No | ||
| level | Choice | alerts, critical, debugging, disable, emergencies, errors, informational, notifications, warning | No |
source_interfaces (iosxr.devices.configuration.logging)
Section titled “source_interfaces (iosxr.devices.configuration.logging)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| name | String | Yes | ||
| vrf | String | Yes |
suppress_rules (iosxr.devices.configuration.logging)
Section titled “suppress_rules (iosxr.devices.configuration.logging)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| name | String | Yes | ||
| alarms | List | [alarms] | No | |
| all_alarms | Boolean | true, false | No | |
| apply_to | Class | [apply_to] | No |
filter_matches (iosxr.devices.configuration.logging.events)
Section titled “filter_matches (iosxr.devices.configuration.logging.events)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| match | String | Yes |
alarms (iosxr.devices.configuration.logging.suppress_rules)
Section titled “alarms (iosxr.devices.configuration.logging.suppress_rules)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| category | String | Yes | ||
| code | String | Yes | ||
| group | String | Yes |
apply_to (iosxr.devices.configuration.logging.suppress_rules)
Section titled “apply_to (iosxr.devices.configuration.logging.suppress_rules)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| all_of_router | Boolean | true, false | No | |
| source_locations | List | [source_locations] | No |
source_locations (iosxr.devices.configuration.logging.suppress_rules.apply_to)
Section titled “source_locations (iosxr.devices.configuration.logging.suppress_rules.apply_to)”| Name | Type | Constraint | Mandatory | Default Value |
|---|---|---|---|---|
| name | String | Yes |
Data Normalization
Section titled “Data Normalization”DSCP and Precedence Values
Logging DSCP and precedence fields accept both numeric and named string values.
ipv4_dscp/ipv6_dscp: integer0-63or named value (e.g.,ef,af11,cs3)ipv4_precedence/ipv6_precedence: integer0-7or named value (e.g.,flash,critical,network)
Both formats can be used interchangeably. The normalization layer automatically converts integer values to their named equivalents before sending to the device, preventing configuration drift.
Syslog Hosts
The hosts list accepts IPv4 addresses, IPv6 addresses, and hostnames in the address field. The Terraform module automatically detects the address type and routes entries to the appropriate attributes (IPv4, IPv6, or hostname). Each host entry requires a vrf field to specify the VRF context (default for the global table).
Example YAML Code:
Section titled “Example YAML Code:”Example-1: Configure basic logging with console, monitor, buffered, and trap settings.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: logging: console: debugging trap: informational monitor: level: notifications buffered: size: 500000 level: errors entries_count: 10000Example-2: Configure logging with archive settings.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: logging: archive: device: disk0 filesize: 100 size: 500 length: 4 severity: informational threshold: 80 frequency: dailyExample-3: Configure logging with filter matches and events configuration.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: logging: events: filter_matches: - match: "MATCH1" buffer_size: 10000 threshold: 80 precfg_suppression: enable precfg_suppression_timeout: 30Example-4: Logging with QoS marking, source interfaces, and global settings.
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: logging: ipv4_dscp: cs3 ipv6_dscp: ef trap: informational events: display_location: true level: warnings console: debugging monitor: level: notifications buffered: size: 500000 level: errors facility_level: local7 hostnameprefix: IOS-XR suppress_duplicates: true format: rfc5424 yang: informational source_interfaces: - name: Loopback0 vrf: default - name: Loopback2 vrf: VRF-2Example-5: Configure logging with VRF-scoped syslog hosts (IPv4, IPv6, and hostname).
iosxr: devices: - name: router-1 host: 10.10.10.1:57400 configuration: logging: hosts: - address: 192.168.1.254 vrf: default severity: debugging operator: equals source_address: 192.168.1.1 - address: log-server vrf: VRF1 severity: info port: 514 operator: equals-or-higher facility: local7 source_address: 10.1.1.1 - address: 2001:db8::254 vrf: VRF2 severity: warning source_address: 2001:db8::1