Skip to content

Logging

Logging provides comprehensive event recording and monitoring capabilities that capture, categorize, and distribute system messages based on configurable severity levels from emergency to debugging. It supports multiple output destinations including console, buffer, file storage, persistent flash storage, and remote syslog servers with flexible transport options including UDP, TCP, and secure TLS connections. Advanced features include message counting with timestamps, rate limiting to prevent log flooding, and persistent logging for long-term retention. Logging configuration enables centralized log collection, real-time monitoring, forensic analysis, and compliance reporting by providing detailed visibility into device operations, security events, and network behavior patterns.

Diagram
NameTypeConstraintMandatoryDefault Value
loggingClass[logging]No

NameTypeConstraintMandatoryDefault Value
monitor_severityStringNo
buffered_sizeIntegermin: 4096, max: 2147483647No
buffered_severityStringNo
buffered_size_legacyIntegermin: 4096, max: 2147483647No
buffered_severity_legacyStringNo
consoleBooleantrue, falseNo
console_severityStringNo
facilityChoiceauth, cron, daemon, kern, local0, local1, local2, local3, local4, local5, local6, local7, lpr, mail, news, sys10, sys11, sys12, sys13, sys14, sys9, syslog, user, uucpNo
history_sizeIntegermin: 0, max: 65535No
history_severityStringNo
trapBooleantrue, falseNo
trap_severityStringNo
origin_id_typeChoicehostname, ip, ipv6No
origin_id_nameStringNo
file_nameStringNo
file_max_sizeIntegermin: 0, max: 4294967295No
file_min_sizeIntegermin: 0, max: 4294967295No
file_severityStringNo
source_interface_typeChoiceLoopback, Vlan, GigabitEthernet, TwoGigabitEthernet, FiveGigabitEthernet, TenGigabitEthernet, TwentyFiveGigabitEthernet, FortyGigabitEthernet, FiftyGigabitEthernet, HundredGigabitEthernetNo
source_interface_idAnyString or Integer[min: 0]No
countBooleantrue, falseNo
persistent_urlStringNo
persistent_sizeIntegermin: 16384, max: 2147483647No
persistent_filesizeIntegermin: 8192, max: 2147483647No
rate_limit_allIntegermin: 1, max: 10000No
source_interfaces_vrfList[source_interfaces_vrf]No
hostsList[hosts]No

source_interfaces_vrf (iosxe.devices.configuration.logging)

Section titled “source_interfaces_vrf (iosxe.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
vrfStringYes
interface_typeChoiceLoopback, Vlan, GigabitEthernet, TwoGigabitEthernet, FiveGigabitEthernet, TenGigabitEthernet, TwentyFiveGigabitEthernet, FortyGigabitEthernet, FiftyGigabitEthernet, HundredGigabitEthernetNo
interface_idAnyString or Integer[min: 0]No

hosts (iosxe.devices.configuration.logging)

Section titled “hosts (iosxe.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
ipIPYes
vrfStringNo
transport_udp_portsListInteger[min: 1, max: 65535]No
transport_tcp_portsListInteger[min: 1, max: 65535]No
transport_tls_portsList[transport_tls_ports]No

transport_tls_ports (iosxe.devices.configuration.logging.hosts)

Section titled “transport_tls_ports (iosxe.devices.configuration.logging.hosts)”
NameTypeConstraintMandatoryDefault Value
portIntegermin: 1025, max: 65535Yes
profileStringNo

By capturing, categorizing, and distributing system messages to various destinations, logging enables real-time analysis, compliance, and operational visibility.

Key Components:

  • Monitor Severity (monitor_severity): Sets the severity level for messages displayed on the terminal.

  • Buffered Log Size and Severity (buffered_size, buffered_severity): Configures the size and severity level for the internal logging buffer. Use these parameters for IOS-XE 17.15 and later versions.

  • Buffered Log Size and Severity - Legacy (buffered_size_legacy, buffered_severity_legacy): Configures the size and severity level for the internal logging buffer on IOS-XE 17.12.x and earlier versions. Use these parameters instead of buffered_size and buffered_severity when targeting older IOS-XE releases.

  • Console Logging (console, console_severity): Enables console logging and sets the severity level for messages sent to the console.

  • Facility (facility): Specifies the syslog facility for remote logging.

  • History Size and Severity (history_size, history_severity): Configures the size and severity level for the logging history.

  • Trap Logging (trap, trap_severity): Enables SNMP trap logging and sets the severity level.

  • Origin ID Type and Name (origin_id_type, origin_id_name): Sets the origin ID for syslog messages.

  • Source Interface (source_interface_type, source_interface_id): Specifies the source interface for outgoing syslog messages.

  • File Logging (file_name, file_max_size, file_severity): Configures file logging with name, maximum size, and severity.

  • Remote Syslog Hosts (hosts): Defines remote syslog servers with IP, VRF, transport type/ports, and TLS profile.

  • Source Interfaces VRF (source_interfaces_vrf): Specifies source interfaces for syslog messages within a VRF.

  • Logging Count (count): Enables message counting and timestamps the last occurrence of each log message for tracking message frequency and patterns.

  • Persistent Logging (persistent_url, persistent_size, persistent_filesize): Configures persistent logging to flash storage with URL path, total disk space allocation, and individual log file size limits for long-term log retention.

  • Rate Limiting (rate_limit_all): Sets a global rate limit for log messages in messages per second to prevent log flooding and ensure system stability during high-volume logging scenarios.

Key Parameters Briefly Explained:

  • monitor_severity: Terminal message severity.
  • buffered_size, buffered_severity: Buffer size and severity (IOS-XE 17.15+).
  • buffered_size_legacy, buffered_severity_legacy: Buffer size and severity (IOS-XE 17.12.x and earlier).
  • console, console_severity: Console logging enable and severity.
  • facility: Syslog facility.
  • history_size, history_severity: History log settings.
  • trap, trap_severity: SNMP trap logging.
  • origin_id_type, origin_id_name: Syslog origin ID.
  • source_interface_type, source_interface_id: Source interface for syslog.
  • file_name, file_max_size, file_severity: File logging settings.
  • hosts: Remote syslog host configuration.
  • source_interfaces_vrf: VRF-specific source interfaces.
  • count: Enable message counting with timestamps.
  • persistent_url: Flash storage URL for persistent logs (e.g., bootflash:/logs).
  • persistent_size: Total disk space for persistent logging (bytes).
  • persistent_filesize: Individual log file size limit (bytes).
  • rate_limit_all: Global message rate limit (messages/second, 1-10000).

You can use these Logging parameters to control how system messages are recorded, filtered, and distributed. Customize severity levels, output destinations, and transport options to fit your network’s monitoring requirements, security policies, and compliance needs. Adjusting these parameters lets you tailor visibility into device operations and network behavior.

Buffered Logging Parameter Version Compatibility

Section titled “Buffered Logging Parameter Version Compatibility”

IOS-XE introduced changes to the YANG model for buffered logging configuration between versions 17.12.x and 17.15.x:

  • IOS-XE 17.15 and later: Use buffered_size and buffered_severity parameters.
  • IOS-XE 17.12.x and earlier: Use buffered_size_legacy and buffered_severity_legacy parameters.

Important: These parameter sets are mutually exclusive. Configure only the appropriate set based on your target IOS-XE version to ensure proper logging buffer configuration.

Persistent URL Filesystem Path Normalization

Section titled “Persistent URL Filesystem Path Normalization”

When configuring the persistent_url parameter for logging on IOS-XE 17.15 and later versions, be aware of the following platform behavior:

Important: IOS-XE 17.15+ automatically normalizes the flash: filesystem prefix to bootflash: in the persistent logging URL configuration. This normalization occurs at the device level and affects both routers and switches.

Recommendation: Always use bootflash: instead of flash: when specifying the persistent URL path on IOS-XE 17.15 and later versions to prevent configuration drift in Terraform.

Example:

  • Recommended: persistent_url: bootflash:/device_logs
  • Not Recommended: persistent_url: flash:/device_logs (will be normalized to bootflash:/device_logs)

Impact: If you configure flash: in your Terraform configuration while running IOS-XE 17.15+, the device will internally store it as bootflash:. This causes Terraform to detect a perpetual difference between the desired state (flash:) and actual state (bootflash:), resulting in idempotency issues where Terraform attempts to “correct” the configuration on every apply.

Note: This behavior does not occur on IOS-XE 17.12 and earlier versions, where the flash: prefix is preserved as configured.

The following configuration describes how to set up logging on a Cisco IOS-XE device, including monitor, buffered, console, file, and remote syslog host settings, severity levels, source interfaces, transport protocols, message counting, persistent logging to flash storage, and rate limiting.

logging monitor informational
logging buffered 16000
logging console warnings
logging facility local0
logging history size 100
logging history informational
logging trap informational
logging origin-id hostname
logging source-interface Loopback0
logging file device-logs.txt 1000000 debugging
logging count
logging persistent url bootflash:/device_logs size 500000 filesize 250000
logging rate-limit all 200
!
logging host 2001::1 transport udp port 514
logging host 2001::1 transport udp port 10000
logging host 2001::1 transport tcp port 10001
logging host 2001::1 transport tcp port 10003
logging host 2001::1 transport tls port 6514 profile TLS-PROFILE-1
logging host vrf MGMT 192.168.5.24
logging host vrf MGMT 192.168.5.24 transport udp port 514

The following YAML code defines logging configuration on an IOS-XE device, including monitor, buffered, console, history, and file logging settings, message counting, persistent flash storage configuration, rate limiting, along with remote syslog hosts configured with various transport options, VRF associations, and source interface settings.

iosxe:
devices:
- name: Device1
configuration:
logging:
monitor_severity: informational
buffered_size: 16000
buffered_severity: informational
console: true
console_severity: warnings
facility: local0
history_size: 100
history_severity: informational
trap: true
trap_severity: informational
origin_id_type: hostname
origin_id_name: CORE-SW-01
source_interface_type: Loopback
source_interface_id: "0"
file_name: device-logs.txt
file_max_size: 1000000
file_severity: debugging
count: true
persistent_url: bootflash:/device_logs
persistent_size: 500000
persistent_filesize: 250000
rate_limit_all: 200
source_interfaces_vrf:
- vrf: MGMT
interface_type: Vlan
interface_id: "100"
hosts:
- ip: 2001::1
transport_udp_ports:
- 514
- 10000
transport_tcp_ports:
- 10001
- 10003
transport_tls_ports:
- port: 6514
profile: TLS-PROFILE-1
- ip: 192.168.5.24
vrf: MGMT
transport_udp_ports:
- 514

Logging provides comprehensive event recording and monitoring capabilities that capture, categorize, and distribute system messages based on configurable severity levels from emergency to debugging. It supports multiple output destinations including console, buffer, file storage, and remote syslog servers with flexible transport options including UDP, TCP, and secure TLS connections. Logging configuration enables centralized log collection, real-time monitoring, forensic analysis, and compliance reporting by providing detailed visibility into device operations, security events, and network behavior patterns.

Diagram
NameTypeConstraintMandatoryDefault Value
loggingClass[logging]No

NameTypeConstraintMandatoryDefault Value
monitor_severityStringNo
buffered_sizeIntegermin: 4096, max: 2147483647No
buffered_severityStringNo
consoleBooleantrue, falseNo
console_severityStringNo
facilityChoiceauth, cron, daemon, kern, local0, local1, local2, local3, local4, local5, local6, local7, lpr, mail, news, sys10, sys11, sys12, sys13, sys14, sys9, syslog, user, uucpNo
history_sizeIntegermin: 0, max: 65535No
history_severityStringNo
trapBooleantrue, falseNo
trap_severityStringNo
origin_id_typeChoicehostname, ip, ipv6No
origin_id_nameStringNo
file_nameStringNo
file_max_sizeIntegermin: 0, max: 4294967295No
file_min_sizeIntegermin: 0, max: 4294967295No
file_severityStringNo
source_interface_typeChoiceLoopback, Vlan, GigabitEthernet, TwoGigabitEthernet, FiveGigabitEthernet, TenGigabitEthernet, TwentyFiveGigabitEthernet, FortyGigabitEthernet, HundredGigabitEthernetNo
source_interface_idAnyString or Integer[min: 0]No
source_interfaces_vrfList[source_interfaces_vrf]No
hostsList[hosts]No

source_interfaces_vrf (iosxe.devices.configuration.logging)

Section titled “source_interfaces_vrf (iosxe.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
vrfStringYes
interface_typeChoiceLoopback, Vlan, GigabitEthernet, TwoGigabitEthernet, FiveGigabitEthernet, TenGigabitEthernet, TwentyFiveGigabitEthernet, FortyGigabitEthernet, HundredGigabitEthernetNo
interface_idAnyString or Integer[min: 0]No

hosts (iosxe.devices.configuration.logging)

Section titled “hosts (iosxe.devices.configuration.logging)”
NameTypeConstraintMandatoryDefault Value
ipIPYes
vrfStringNo
transport_udp_portsListInteger[min: 1, max: 65535]No
transport_tcp_portsListInteger[min: 1, max: 65535]No
transport_tls_portsList[transport_tls_ports]No

transport_tls_ports (iosxe.devices.configuration.logging.hosts)

Section titled “transport_tls_ports (iosxe.devices.configuration.logging.hosts)”
NameTypeConstraintMandatoryDefault Value
portIntegermin: 1025, max: 65535Yes
profileStringNo

By capturing, categorizing, and distributing system messages to various destinations, logging enables real-time analysis, compliance, and operational visibility.

Key Components:

  • Monitor Severity (monitor_severity): Sets the severity level for messages displayed on the terminal.

  • Buffered Log Size and Severity (buffered_size, buffered_severity): Configures the size and severity level for the internal logging buffer.

  • Console Logging (console, console_severity): Enables console logging and sets the severity level for messages sent to the console.

  • Facility (facility): Specifies the syslog facility for remote logging.

  • History Size and Severity (history_size, history_severity): Configures the size and severity level for the logging history.

  • Trap Logging (trap, trap_severity): Enables SNMP trap logging and sets the severity level.

  • Origin ID Type and Name (origin_id_type, origin_id_name): Sets the origin ID for syslog messages.

  • Source Interface (source_interface_type, source_interface_id): Specifies the source interface for outgoing syslog messages.

  • File Logging (file_name, file_max_size, file_severity): Configures file logging with name, maximum size, and severity.

  • Remote Syslog Hosts (hosts): Defines remote syslog servers with IP, VRF, transport type/ports, and TLS profile.

  • Source Interfaces VRF (source_interfaces_vrf): Specifies source interfaces for syslog messages within a VRF.

Key Parameters Briefly Explained:

  • monitor_severity: Terminal message severity.
  • buffered_size, buffered_severity: Buffer size and severity.
  • console, console_severity: Console logging enable and severity.
  • facility: Syslog facility.
  • history_size, history_severity: History log settings.
  • trap, trap_severity: SNMP trap logging.
  • origin_id_type, origin_id_name: Syslog origin ID.
  • source_interface_type, source_interface_id: Source interface for syslog.
  • file_name, file_max_size, file_severity: File logging settings.
  • hosts: Remote syslog host configuration.
  • source_interfaces_vrf: VRF-specific source interfaces.

You can use these Logging parameters to control how system messages are recorded, filtered, and distributed. Customize severity levels, output destinations, and transport options to fit your network’s monitoring requirements, security policies, and compliance needs. Adjusting these parameters lets you tailor visibility into device operations and network behavior.

The following configuration describes how to set up logging on a Cisco IOS-XE device, including monitor, buffered, console, file, and remote syslog host settings, severity levels, source interfaces, and transport protocols.

logging monitor informational
logging buffered 16000
logging console warnings
logging facility local0
logging history size 100
logging history informational
logging trap informational
logging origin-id hostname
logging source-interface Loopback0
logging file device-logs.txt 1000000 debugging
!
logging host 2001::1 transport udp port 514
logging host 2001::1 transport udp port 10000
logging host 2001::1 transport tcp port 10001
logging host 2001::1 transport tcp port 10003
logging host 2001::1 transport tls port 6514 profile TLS-PROFILE-1
logging host vrf MGMT 192.168.5.24
logging host vrf MGMT 192.168.5.24 transport udp port 514

The following YAML code defines logging configuration on an IOS-XE device, including monitor, buffered, console, history, and file logging settings, along with remote syslog hosts configured with various transport options, VRF associations, and source interface settings.

iosxe:
devices:
- name: Device1
configuration:
logging:
monitor_severity: informational
buffered_size: 16000
buffered_severity: informational
console_severity: warnings
facility: local0
history_size: 100
history_severity: informational
trap: true
trap_severity: informational
origin_id_type: hostname
origin_id_name: CORE-SW-01
source_interface_type: Loopback
source_interface_id: "0"
file_name: device-logs.txt
file_max_size: 1000000
file_severity: debugging
source_interfaces_vrf:
- vrf: MGMT
interface_type: Vlan
interface_id: "100"
hosts:
- ip: 2001::1
transport_udp_ports:
- 514
- 10000
transport_tcp_ports:
- 10001
- 10003
transport_tls_ports:
- port: 6514
profile: TLS-PROFILE-1
- ip: 192.168.5.24
vrf: MGMT
transport_udp_ports:
- 514