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.
// 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:]+)( |$)/mlogging trap informationallogging events link-status software-interfaceslogging console criticallogging buffered 10000000logging 192.0.2.20 vrf MGMT severity info port defaultlogging 192.0.2.21 vrf MGMT severity info port defaultlogging source-interface MgmtEth0/RSP0/CPU0/0 vrf MGMTWhy: Two syslog hosts are set by address.
logging trap informationallogging events link-status software-interfaceslogging console informationallogging buffered 10000000logging source-interface MgmtEth0/RSP0/CPU0/0 vrf MGMTWhy: No syslog host is set.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
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.
// Log timestamps include milliseconds (fails on service timestamps log without datetime msec)#[must_not_match_regex]/^service timestamps log (?!datetime\b.*\bmsec\b)/mlogging hostnameprefix dub-rtr01service timestamps log datetime localtime msec show-timezoneservice timestamps debug datetime localtime msec show-timezoneWhy: Log timestamps include milliseconds.
logging hostnameprefix dub1-pr-asr02service timestamps log datetime localtime show-timezoneservice timestamps debug datetime localtime msec show-timezoneWhy: Log timestamps have no msec.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
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.
// 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)$/mlogging trap informationallogging events link-status software-interfaceslogging console criticallogging buffered 10000000Why: Console logging is limited to critical.
logging trap informationallogging events link-status software-interfaceslogging console informationallogging buffered 10000000Why: Console logging is at informational.
Expected result in rConfig, with this rule as the only rule in a definition:
| Config | Rule result | Overall result |
|---|---|---|
| Passing config | pass | PASS |
| Failing config | fail | FAIL |
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.
Related reference
- Cisco IOS XR policy templates: every rule in
iosxr-logging.policy, its references and known limitations. - Policy Definitions: the definition file format and every method.
- Policy Assignments: run a definition against your devices.
- Policy Compliance Results: read the pass and fail results.