Skip to content

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
NameTypeConstraintMandatoryDefault Value
loggingClass[logging]No

NameTypeConstraintMandatoryDefault Value
archiveClass[archive]No
bufferedClass[buffered]No
consoleChoicealerts, critical, debugging, disable, emergencies, errors, informational, notifications, warningNo
console_facilityChoiceallNo
container_allBooleantrue, falseNo
container_fetch_timestampBooleantrue, falseNo
eventsClass[events]No
facility_levelChoiceall, audit, auth, authpriv, console, daemon, kern, local0, local1, local2, local3, local4, local5, local6, local7, mail, ntp, syslog, userNo
filesList[files]No
formatChoicebsd, rfc5424No
historyChoicealerts, critical, debugging, disable, emergencies, errors, informational, notifications, warningsNo
hostsList[hosts]No
history_sizeIntegermin: 1, max: 500No
hostnameprefixStringNo
ipv4_dscpAnyInteger[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_precedenceAnyInteger[min: 0, max: 7] or Choice[critical, flash, flash-override, immediate, internet, network, priority, routine] or String[Regex: ^.*[\$\%]\{.*$]No
ipv6_dscpAnyInteger[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_precedenceAnyInteger[min: 0, max: 7] or Choice[critical, flash, flash-override, immediate, internet, network, priority, routine] or String[Regex: ^.*[\$\%]\{.*$]No
localfilesizeIntegermin: 0, max: 4294967295No
monitorClass[monitor]No
source_interfacesList[source_interfaces]No
suppress_duplicatesBooleantrue, falseNo
suppress_rulesList[suppress_rules]No
trapChoicealerts, critical, debugging, disable, emergencies, errors, informational, notifications, warningNo
yangChoicealerts, critical, debugging, emergencies, errors, informational, notifications, warningsNo

archive (iosxr.devices.configuration.logging)

Section titled “archive (iosxr.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
deviceChoicedisk0, disk1, harddiskYes
filesizeIntegermin: 1, max: 2047No
frequencyChoicedaily, weeklyNo
lengthIntegermin: 1, max: 256No
severityChoicealerts, critical, debugging, emergencies, errors, informational, notifications, warningsNo
sizeIntegermin: 1, max: 2047No
thresholdIntegermin: 1, max: 99No

buffered (iosxr.devices.configuration.logging)

Section titled “buffered (iosxr.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
discriminator_match1StringNo
discriminator_match2StringNo
discriminator_match3StringNo
discriminator_nomatch1StringNo
discriminator_nomatch2StringNo
discriminator_nomatch3StringNo
entries_countIntegermin: 2545, max: 151699No
levelChoicealerts, critical, debugging, emergencies, errors, informational, notifications, warningsNo
sizeIntegermin: 307200, max: 125000000No

events (iosxr.devices.configuration.logging)

Section titled “events (iosxr.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
buffer_sizeIntegermin: 1024, max: 1024000No
display_locationBooleantrue, falseNo
filter_matchesList[filter_matches]No
levelChoicealerts, critical, emergencies, errors, informational, notifications, warningsNo
precfg_suppressionChoiceenableNo
precfg_suppression_timeoutIntegermin: 1, max: 60No
thresholdIntegermin: 10, max: 100No

files (iosxr.devices.configuration.logging)

Section titled “files (iosxr.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
accounting_remote_facilityChoiceauth, cron, daemon, kern, local0, local1, local2, local3, local4, local5, local6, local7, lpr, mail, news, sys10, sys11, sys12, sys13, sys14, sys9, syslog, user, uucpNo
discriminator_match1StringNo
discriminator_match2StringNo
discriminator_match3StringNo
discriminator_nomatch1StringNo
discriminator_nomatch2StringNo
discriminator_nomatch3StringNo
maxfilesizeIntegermin: 1, max: 2097152No
pathStringNo
severityChoicealerts, critical, debugging, emergencies, error, info, notifications, warningNo

hosts (iosxr.devices.configuration.logging)

Section titled “hosts (iosxr.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
addressStringYes
vrfStringYes
severityChoicealerts, critical, debugging, emergencies, error, info, notifications, warningNo
portIntegermin: 0, max: 65535No
operatorChoiceequals, equals-or-higher, not-equalsNo
facilityChoiceall, audit, auth, authpriv, console, daemon, kern, local0, local1, local2, local3, local4, local5, local6, local7, mail, ntp, syslog, userNo
source_addressStringNo

monitor (iosxr.devices.configuration.logging)

Section titled “monitor (iosxr.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
discriminator_match1StringNo
discriminator_match2StringNo
discriminator_match3StringNo
discriminator_nomatch1StringNo
discriminator_nomatch2StringNo
discriminator_nomatch3StringNo
levelChoicealerts, critical, debugging, disable, emergencies, errors, informational, notifications, warningNo

source_interfaces (iosxr.devices.configuration.logging)

Section titled “source_interfaces (iosxr.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
vrfStringYes

suppress_rules (iosxr.devices.configuration.logging)

Section titled “suppress_rules (iosxr.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
alarmsList[alarms]No
all_alarmsBooleantrue, falseNo
apply_toClass[apply_to]No

filter_matches (iosxr.devices.configuration.logging.events)

Section titled “filter_matches (iosxr.devices.configuration.logging.events)”
NameTypeConstraintMandatoryDefault Value
matchStringYes

alarms (iosxr.devices.configuration.logging.suppress_rules)

Section titled “alarms (iosxr.devices.configuration.logging.suppress_rules)”
NameTypeConstraintMandatoryDefault Value
categoryStringYes
codeStringYes
groupStringYes

apply_to (iosxr.devices.configuration.logging.suppress_rules)

Section titled “apply_to (iosxr.devices.configuration.logging.suppress_rules)”
NameTypeConstraintMandatoryDefault Value
all_of_routerBooleantrue, falseNo
source_locationsList[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)”
NameTypeConstraintMandatoryDefault Value
nameStringYes

DSCP and Precedence Values

Logging DSCP and precedence fields accept both numeric and named string values.

  • ipv4_dscp / ipv6_dscp: integer 0-63 or named value (e.g., ef, af11, cs3)
  • ipv4_precedence / ipv6_precedence: integer 0-7 or 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-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: 10000

Example-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: daily

Example-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: 30

Example-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-2

Example-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