.. _dellemc.enterprise_sonic.sonic_logging_module: ************************************** dellemc.enterprise_sonic.sonic_logging ************************************** **Manage logging configuration on SONiC.** Version added: 2.1.0 .. contents:: :local: :depth: 1 Synopsis -------- - This module provides configuration management of logging for devices running SONiC. Parameters ---------- .. raw:: html
Parameter Choices/Defaults Comments
config
dictionary
Specifies logging related configurations.
remote_servers
list / elements=dictionary
Remote logging sever configuration.
host
string / required
IPv4/IPv6 address or host name of the remote logging server.
message_type
string
    Choices:
  • log
  • event
  • audit
  • auditd-system
Type of messages that remote server receives. Defaults to "log" value.
protocol
string
    Choices:
  • TCP
  • TLS
  • UDP
Type of the protocol for sending the messages. Defaults to "UDP" value.
remote_port
integer
Destination port number for logging messages sent to the server.
severity
string
added in 3.1.0
    Choices:
  • debug
  • info
  • notice
  • warning
  • error
  • critical
  • alert
  • emergency
The log severity filter for remote syslog server. Defaults to "notice" value.
source_interface
string
Source interface used as source ip for sending logging packets.
vrf
string
VRF name used by remote logging server.
security_profile
string
added in 3.1.0
Specifies the security profile name for the global syslog settings.
state
string
    Choices:
  • merged ←
  • replaced
  • overridden
  • deleted
The state of the configuration after module completion.

Notes ----- .. note:: - Supports ``check_mode``. Examples -------- .. code-block:: yaml # Using "deleted" state # # Before state: # ------------- # # sonic# show logging servers # ---------------------------------------------------------------------------------------------------------- # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL # ---------------------------------------------------------------------------------------------------------- # 10.11.0.2 5 Ethernet24 - event notice udp # 10.11.1.1 616 Ethernet8 - log alert tcp # log1.dell.com 6 Ethernet28 - audit notice udp # 10.11.1.2 116 Ethernet6 - log notice tls # # sonic# show running-configuration | grep logging # ! # logging security-profile default # ! - name: Delete logging server configuration sonic_logging: config: remote_servers: - host: 10.11.0.2 - host: log1.dell.com - host: 10.11.1.1 message_type: log protocol: tcp source_interface: Ethernet8 severity: alert security_profile: "default" state: deleted # After state: # ------------ # # sonic# show logging servers # ---------------------------------------------------------------------------------------------------------- # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL # ---------------------------------------------------------------------------------------------------------- # 10.11.1.1 616 - - log notice udp # 10.11.1.2 116 Ethernet6 - log notice tls # # sonic# show running-configuration | grep logging # sonic# # # Using "merged" state # # Before state: # ------------- # # sonic# show logging servers # ---------------------------------------------------------------------------------------------------------- # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL # ---------------------------------------------------------------------------------------------------------- # 10.11.1.1 616 Ethernet8 - log notice tcp # # sonic# show running-configuration | grep logging # sonic# - name: Merge logging server configuration sonic_logging: config: remote_servers: - host: 10.11.0.2 remote_port: 5 protocol: TCP source_interface: Ethernet24 message_type: event - host: 10.11.0.1 remote_port: 4 protocol: TLS source_interface: Ethernet2 - host: 10.11.1.1 severity: error - host: log1.dell.com remote_port: 6 protocol: udp source_interface: Ethernet28 message_type: audit security_profile: "default" state: merged # After state: # ------------ # sonic# show logging servers # ---------------------------------------------------------------------------------------------------------- # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL # ---------------------------------------------------------------------------------------------------------- # 10.11.0.2 5 Ethernet24 - event notice udp # 10.11.0.1 4 Ethernet2 - log notice tls # 10.11.1.1 616 Ethernet8 - log error tcp # log1.dell.com 6 Ethernet28 - audit notice udp # sonic# show running-configuration | grep logging # ! # logging security-profile default # ! # # # Using "overridden" state # # Before state: # ------------- # # sonic# show logging servers # ---------------------------------------------------------------------------------------------------------- # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL # ---------------------------------------------------------------------------------------------------------- # 10.11.1.1 616 Ethernet8 - log notice tcp # 10.11.1.2 626 Ethernet16 - event emergency udp # 10.11.1.3 626 Ethernet14 - log notice tls # # sonic# show running-configuration | grep logging # ! # logging security-profile default # ! - name: Override logging server configuration sonic_logging: config: remote_servers: - host: 10.11.1.2 remote_port: 622 protocol: TCP source_interface: Ethernet24 message_type: audit severity: alert state: overridden # # After state: # ------------ # sonic# show logging servers # ---------------------------------------------------------------------------------------------------------- # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL # ---------------------------------------------------------------------------------------------------------- # 10.11.1.2 622 Ethernet24 - audit alert tcp # sonic# show running-configuration | grep logging # sonic# # # Using "replaced" state # # Before state: # ------------- # # sonic# show logging servers # ---------------------------------------------------------------------------------------------------------- # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL # ---------------------------------------------------------------------------------------------------------- # 10.11.1.1 616 Ethernet8 - log notice tcp # 10.11.1.2 626 Ethernet16 - event notice udp # # sonic# show running-configuration | grep logging # sonic# - name: Replace logging server configuration sonic_logging: config: remote_servers: - host: 10.11.1.2 remote_port: 622 protocol: UDP message_type: audit severity: debug security_profile: "default" state: replaced # # After state: # ------------ # # "MESSAGE-TYPE" has default value of "log" # # ---------------------------------------------------------------------------------------------------------- # HOST PORT SOURCE-INTERFACE VRF MESSAGE-TYPE SEVERITY PROTOCOL # ---------------------------------------------------------------------------------------------------------- # 10.11.1.1 616 Ethernet8 - log notice tcp # 10.11.1.2 622 - - audit debug udp # sonic# show running-configuration | grep logging # ! # logging security-profile default # ! # Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this module: .. raw:: html
Key Returned Description
after
list
when changed
The resulting configuration module invocation.

Sample:
The configuration returned will always be in the same format as the parameters above.
after_generated
list
when check_mode
The generated configuration module invocation.

Sample:
The configuration returned will always be in the same format as the parameters above.
before
list
always
The configuration prior to the module invocation.

Sample:
The configuration returned will always be in the same format as the parameters above.
commands
list
always
The set of commands pushed to the remote device.

Sample:
['command 1', 'command 2', 'command 3']


Status ------ Authors ~~~~~~~ - M\. Zhang (@mingjunzhang2019)