Skip to content
Guides & References

IOS XR logging

Worked examples for the IOS XR logging template: a remote syslog host, millisecond log timestamps, and console logging off or limited to critical.

Policy LibraryUpdated
Platform
cisco-ios-xr
Minimum version
rConfig 8.0.2
Editions
Pro, Vector, Enterprise
On this page

IOS XR logging

Rules that make sure logs leave the router, carry precise timestamps, and do not flood the console. They come from the iosxr-logging policy template.

Every example on this page was checked with rConfig Pro's policy engine on

Each of the 6 configs below was run through rConfig Pro’s evaluator with the rule above it, and gave the result shown. The configs are sanitised excerpts of the sample configs that come with the template.

All the rules come from iosxr-logging.policy in the policy templates (v1.5.0). Import the whole file with Import Templates (see importing a policy template), or copy one rule into your own definition. The Cisco IOS XR templates page lists the file’s known limitations. Run the rules against show running-config.

Rule Method Since
Remote syslog host must_match_regex 8.0.0
Millisecond log timestamps must_not_match_regex 8.0.2
Console logging off or critical must_match_regex 8.0.0

Remote syslog host

Logs kept only on the router are lost when it reboots, and an attacker on the box can clear them. This rule passes when a logging line starts with an IPv4 or IPv6 address. A host given by name does not count.

Definition
// A remote syslog host is configured by address (logging <address>)
#[must_match_regex]
/^logging (\d{1,3}(\.\d{1,3}){3}|[0-9A-Fa-f]*:[0-9A-Fa-f:]+)( |$)/m
passPassing config: Hardened ASR 9901 sample (IOS XR 7.9.2, synthetic)
logging trap informational
logging events link-status software-interfaces
logging console critical
logging buffered 10000000
logging 192.0.2.20 vrf MGMT severity info port default
logging 192.0.2.21 vrf MGMT severity info port default
logging source-interface MgmtEth0/RSP0/CPU0/0 vrf MGMT

Why: Two syslog hosts are set by address.

failFailing config: Unhardened ASR 9901 sample (IOS XR 7.9.2, synthetic)
logging trap informational
logging events link-status software-interfaces
logging console informational
logging buffered 10000000
logging source-interface MgmtEth0/RSP0/CPU0/0 vrf MGMT

Why: No syslog host is set.

Expected result in rConfig, with this rule as the only rule in a definition:

ConfigRule resultOverall result
Passing configpassPASS
Failing configfailFAIL

Framework mapping. The rule provides evidence towards these controls. It does not certify anything.

Framework Reference
NIST SP 800-53 AU-2
HIPAA (45 CFR) 164.312(b)
ISO/IEC 27001:2022 Annex A A.8.15

Tested with: sample excerpts from IOS XR 7.9.2 (synthetic). Minimum rConfig 8.0.0 (must_match_regex). Editions: Pro, Vector, Enterprise.


Millisecond log timestamps

Millisecond timestamps let you put events from several devices in the right order. This rule fails on a service timestamps log line that does not have datetime and msec. If the config has no such line at all, the rule passes, so check your routers print one.

Definition
// Log timestamps include milliseconds (fails on service timestamps log without datetime msec)
#[must_not_match_regex]
/^service timestamps log (?!datetime\b.*\bmsec\b)/m
passPassing config: Hardened ASR 9901 sample (IOS XR 7.9.2, synthetic)
logging hostnameprefix dub-rtr01
service timestamps log datetime localtime msec show-timezone
service timestamps debug datetime localtime msec show-timezone

Why: Log timestamps include milliseconds.

failFailing config: Unhardened ASR 9901 sample (IOS XR 7.9.2, synthetic)
logging hostnameprefix dub1-pr-asr02
service timestamps log datetime localtime show-timezone
service timestamps debug datetime localtime msec show-timezone

Why: Log timestamps have no msec.

Expected result in rConfig, with this rule as the only rule in a definition:

ConfigRule resultOverall result
Passing configpassPASS
Failing configfailFAIL

Framework mapping. The rule provides evidence towards these controls. It does not certify anything.

Framework Reference
NIST SP 800-53 AU-3
HIPAA (45 CFR) 164.312(b)
ISO/IEC 27001:2022 Annex A A.8.15

Tested with: sample excerpts from IOS XR 7.9.2 (synthetic). Minimum rConfig 8.0.2 (must_not_match_regex). Editions: Pro, Vector, Enterprise.


Console logging off or critical

IOS XR logs to the console at informational by default, which can slow the router during an event. The default is not printed, so this rule needs a logging console line set to disable, critical, alerts or emergencies.

Definition
// Console logging is disabled or limited to critical and above (logging console disable, critical, alerts or emergencies)
#[must_match_regex]
/^logging console (disable|critical|alerts|emergencies)$/m
passPassing config: Hardened ASR 9901 sample (IOS XR 7.9.2, synthetic)
logging trap informational
logging events link-status software-interfaces
logging console critical
logging buffered 10000000

Why: Console logging is limited to critical.

failFailing config: Unhardened ASR 9901 sample (IOS XR 7.9.2, synthetic)
logging trap informational
logging events link-status software-interfaces
logging console informational
logging buffered 10000000

Why: Console logging is at informational.

Expected result in rConfig, with this rule as the only rule in a definition:

ConfigRule resultOverall result
Passing configpassPASS
Failing configfailFAIL

Framework mapping. The rule provides evidence towards these controls. It does not certify anything.

Framework Reference
NIST SP 800-53 AU-6
HIPAA (45 CFR) 164.312(b)

Tested with: sample excerpts from IOS XR 7.9.2 (synthetic). Minimum rConfig 8.0.0 (must_match_regex). Editions: Pro, Vector, Enterprise.


Type to search.