Skip to content
Guides & References

IOS-XE logging

Worked examples for Cisco IOS-XE logging: a remote syslog host, millisecond timestamps, no console logging, buffered logging and a trap level.

Policy LibraryUpdated
Platform
Cisco IOS-XE
Minimum version
rConfig 8.0.2
Editions
Pro, Vector, Enterprise
On this page

IOS-XE logging

Rules for where logs go and how useful they are. Logs that stay on the device are lost on a reload, and logs without exact times are hard to match up across devices. They come from the ios-logging policy template.

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

Each of the 11 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. A card marked changed has one line edited to show a failure.

All the rules come from ios-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 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_match_regex 8.0.0
No console logging must_not_match_regex 8.0.2
Buffered logging must_match_regex 8.0.0
Trap severity level must_match_regex 8.0.0

Remote syslog host

A copy of the logs off the device survives a reload, and an attacker on the device cannot delete it. This rule passes when there is at least one logging host line. It does not check which host.

Definition
// A remote syslog host is configured (logging host)
#[must_match_regex]
/^logging host \S+/m
passPassing config: Hardened Catalyst 9500 sample (IOS-XE 17.9, synthetic)
logging trap informational
logging source-interface Vlan99
logging host 192.0.2.50

Why: Logs are sent to 192.0.2.50.

failFailing config: Hardened Catalyst 9500 sample (IOS-XE 17.9, synthetic), changed: logging host line removed
logging trap informational
logging source-interface Vlan99

Why: There is no logging host line, so logs stay on the device.

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-XE 17.9 (synthetic). Minimum rConfig 8.0.0 (must_match_regex). Editions: Pro, Vector, Enterprise.


Millisecond log timestamps

Timestamps with datetime msec let you put events from many devices in the right order. This rule allows extra options such as localtime and show-timezone, in any order, as long as msec is there.

Definition
// Log timestamps use datetime msec, with or without other options (service timestamps log datetime msec ...)
#[must_match_regex]
/^service timestamps log datetime(?: \S+)*? msec(?: \S+)*$/m
passPassing config: Hardened Catalyst 9500 sample (IOS-XE 17.9, synthetic)
service timestamps log datetime msec

Why: Date, time and milliseconds.

passPassing config: Catalyst 9500 sample (IOS-XE 17.9, synthetic)
service timestamps log datetime msec localtime show-timezone

Why: Extra options are fine.

failFailing config: Hardened Catalyst 9500 sample (IOS-XE 17.9, synthetic), changed: uptime instead of datetime msec
service timestamps log uptime

Why: uptime shows time since boot, not the date and time.

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

ConfigRule resultOverall result
Passing config 1passPASS
Passing config 2passPASS
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-XE 17.9 (synthetic). Minimum rConfig 8.0.0 (must_match_regex). Editions: Pro, Vector, Enterprise.


No console logging

Sending log messages to the console slows the device down when there are many, and nobody is usually watching. This rule fails on any logging console line, at any level. IOS prints no logging console when it is off.

Definition
// Console logging is off (no logging console line at any level)
#[must_not_match_regex]
/^logging console\b/m
passPassing config: Hardened Catalyst 9500 sample (IOS-XE 17.9, synthetic)
logging buffered 64000 informational
no logging console

Why: Console logging is off.

failFailing config: Catalyst 9500 sample (IOS-XE 17.9, synthetic)
logging buffered 64000 informational
logging console warnings

Why: Console logging is on, at warnings level.

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-XE 17.9 (synthetic). Minimum rConfig 8.0.2 (must_not_match_regex). Editions: Pro, Vector, Enterprise.


Buffered logging

The log buffer keeps recent messages in memory, so show logging has something to show when the syslog server cannot be reached. This rule passes when a logging buffered line sets a size or level.

Definition
// Buffered logging is configured (logging buffered)
#[must_match_regex]
/^logging buffered \S+/m
passPassing config: Hardened Catalyst 9500 sample (IOS-XE 17.9, synthetic)
logging buffered 64000 informational
no logging console

Why: A 64000 byte buffer at informational level.

failFailing config: Hardened Catalyst 9500 sample (IOS-XE 17.9, synthetic), changed: logging buffered line removed
no logging console

Why: There is no logging buffered line.

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
ISO/IEC 27001:2022 Annex A A.8.15

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


Trap severity level

The trap level decides which messages go to the syslog server. debugging floods the server, so this rule allows every named level except debugging. The level must be the last word on the line.

Definition
// The logging trap severity level is set (logging trap <level>)
#[must_match_regex]
/^logging trap (warnings|errors|informational|notifications|alerts|critical|emergencies)$/m
passPassing config: Hardened Catalyst 9500 sample (IOS-XE 17.9, synthetic)
logging trap informational
logging source-interface Vlan99
logging host 192.0.2.50

Why: The trap level is informational.

failFailing config: Hardened Catalyst 9500 sample (IOS-XE 17.9, synthetic), changed: debugging instead of informational
logging trap debugging
logging source-interface Vlan99
logging host 192.0.2.50

Why: debugging is not in the allowed list.

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
ISO/IEC 27001:2022 Annex A A.8.15

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


Type to search.