cisco.nxos.nxos_logging_global 模块 – 日志资源模块。
注意
此模块是 cisco.nxos 集合 (版本 9.2.1) 的一部分。
如果您使用的是 ansible
包,您可能已经安装了此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install cisco.nxos
。
要在 playbook 中使用它,请指定: cisco.nxos.nxos_logging_global
。
cisco.nxos 2.5.0 中的新功能
概要
此模块管理运行 Cisco NX-OS 的设备上的日志记录配置。
参数
参数 |
注释 |
---|---|
日志配置的字典。 |
|
设置控制台日志记录参数。 |
|
为控制台设置严重性。 选择
|
|
启用或禁用监视器日志记录。 选择
|
|
接口事件。 |
|
UPDOWN 和 CHANGE 消息。 |
|
未显式配置的接口使用的默认日志记录配置。 选择
|
|
启用日志记录以覆盖端口严重性配置。 选择
|
|
TRUNK 状态消息。 |
|
未显式配置的接口使用的默认日志记录配置。 选择
|
|
启用日志记录以覆盖端口严重性配置。 选择
|
|
用于 syslog 消息的 Facility 参数。 |
|
Facility 名称。 |
|
为控制台设置严重性。 选择
|
|
修改历史记录表的严重性或大小。 |
|
为控制台设置严重性。 选择
|
|
设置历史记录表大小。 |
|
启用转发到远程 Syslog 服务器。 |
|
转发到服务器时要使用的 Facility。 |
|
远程 Syslog 服务器的主机名/IPv4/IPv6 地址。 |
|
转发到远程服务器时的目标端口。 |
|
启用与远程服务器的安全连接。 |
|
Trustpoint 配置。 |
|
用于相互身份验证的客户端身份证书。 用于客户端证书身份验证的 Trustpoint。 |
|
为控制台设置严重性。 选择
|
|
显示每个 VRF 的信息。 MDS 交换机不支持此选项。 |
|
IP 配置。 MDS 交换机不支持此选项。 |
|
访问列表。 |
|
设置缓存设置。 |
|
软件中缓存的最大日志条目数。 |
|
日志更新间隔(秒)。 |
|
日志更新阈值(命中次数) |
|
详细的 ACL 信息。 选择
|
|
在 syslog 中包含其他字段。 |
|
在 syslog 中包含源组标签信息。 选择
|
|
设置文件日志记录。 |
|
日志文件名。 |
|
设置持久日志记录利用率警报阈值,以百分比表示。 MDS 交换机不支持此选项。 |
|
为控制台设置严重性。 选择
|
|
以字节为单位输入日志文件大小。 |
|
启用或禁用日志文件。 选择
|
|
设置模块(线卡)日志记录。 |
|
为控制台设置严重性。 选择
|
|
启用或禁用模块日志记录。 选择
|
|
设置终端行(监视器)日志记录严重性。 |
|
为控制台设置严重性。 选择
|
|
启用或禁用监视器日志记录。 选择
|
|
为远程 Syslog 服务器启用源信息。 |
|
使用主机名作为日志消息的源 ID。 此选项与 *ip* 和 *string* 互斥。 选择
|
|
使用 IP 地址作为日志消息的源 ID。 此选项与 *hostname* 和 *string* 互斥。 |
|
使用文本字符串作为日志消息的源 ID。 此选项与 *hostname* 和 *ip* 互斥。 |
|
启用或禁用日志消息的速率限制。 选择
|
|
设置消息应符合的 RFC。 syslog 将符合 RFC 5424。 MDS 交换机不支持此选项。 选择
|
|
为远程 Syslog 服务器启用源接口。 MDS 交换机不支持此选项。 |
|
设置日志时间戳粒度。 选择
|
|
此选项仅与状态 *parsed* 一起使用。 此选项的值应该是从 NX-OS 设备执行命令 **show running-config | include logging** 收到的输出。 状态 *parsed* 从 |
|
应将配置保留在的状态。 状态 *replaced* 和 *overridden* 对于此模块具有相同的行为。 有关更多详细信息,请参阅示例。 选择
|
说明
注意
在 Cisco Nexus 交换机上针对 NX-OS 9.3.6 进行了测试。
对 Cisco MDS 的有限支持
此模块适用于连接
network_cli
和httpapi
。使用连接
network_cli
针对 Cisco MDS NX-OS 9.2(2) 进行了测试。
示例
# Using merged
# Before state:
# -------------
# nxos-9k-rdo# show running-config | include logging
# nxos-9k-rdo#
- name: Merge the provided configuration with the existing running configuration
cisco.nxos.nxos_logging_global:
config:
console:
severity: error
monitor:
severity: warning
ip:
access_list:
cache:
entries: 16384
interval: 200
threshold: 5000
facilities:
- facility: auth
severity: critical
- facility: ospfv3
severity: alert
- facility: ftp
severity: informational
hosts:
- host: 203.0.113.100
severity: alert
use_vrf: management
- host: 203.0.113.101
severity: error
facility: local6
use_vrf: default
origin_id:
hostname: true
# Task output
# -------------
# before: {}
#
# commands:
# - "logging console 3"
# - "logging monitor 4"
# - "logging ip access-list cache entries 16384"
# - "logging ip access-list cache interval 200"
# - "logging ip access-list cache threshold 5000"
# - "logging severity auth 2"
# - "logging severity ospfv3 1"
# - "logging severity ftp 6"
# - "logging server 203.0.113.100 1 use-vrf management"
# - "logging server 203.0.113.101 3 facility local6 use-vrf default"
# - "logging origin-id hostname"
#
# after:
# console:
# severity: error
# facilities:
# - facility: auth
# severity: critical
# - facility: ftp
# severity: informational
# - facility: ospfv3
# severity: alert
# ip:
# access_list:
# cache:
# entries: 16384
# interval: 200
# threshold: 5000
# monitor:
# severity: warning
# origin_id:
# hostname: true
# hosts:
# - severity: alert
# host: 203.0.113.100
# use_vrf: management
# - facility: local6
# severity: error
# host: 203.0.113.101
# use_vrf: default
# After state:
# ------------
# nxos-9k-rdo# show running-config | include logging
# logging console 3
# logging monitor 4
# logging ip access-list cache entries 16384
# logging ip access-list cache interval 200
# logging ip access-list cache threshold 5000
# logging severity auth 2
# logging severity ospfv3 1
# logging severity ftp 6
# logging origin-id hostname
# logging server 203.0.113.100 1 use-vrf management
# logging server 203.0.113.101 3 use-vrf default facility local6
# Using replaced
# Before state:
# ------------
# nxos-9k-rdo# show running-config | include logging
# logging console 3
# logging monitor 4
# logging ip access-list cache entries 16384
# logging ip access-list cache interval 200
# logging ip access-list cache threshold 5000
# logging severity auth 2
# logging severity ospfv3 1
# logging severity ftp 6
# logging origin-id hostname
# logging server 203.0.113.100 1 use-vrf management
# logging server 203.0.113.101 3 use-vrf default facility local6
- name: Replace logging configurations with provided config
cisco.nxos.nxos_logging_global:
config:
monitor:
severity: warning
ip:
access_list:
cache:
entries: 4096
facilities:
- facility: auth
severity: critical
- facility: ospfv3
severity: alert
- facility: ftp
severity: informational
hosts:
- host: 203.0.113.101
severity: error
facility: local6
use_vrf: default
- host: 198.51.100.101
severity: alert
port: 6538
use_vrf: management
origin_id:
ip: 192.0.2.100
state: replaced
# Task output
# -------------
# before:
# console:
# severity: error
# facilities:
# - facility: auth
# severity: critical
# - facility: ftp
# severity: informational
# - facility: ospfv3
# severity: alert
# ip:
# access_list:
# cache:
# entries: 16384
# interval: 200
# threshold: 5000
# monitor:
# severity: warning
# origin_id:
# hostname: true
# hosts:
# - severity: alert
# host: 203.0.113.100
# use_vrf: management
# - facility: local6
# severity: error
# host: 203.0.113.101
# use_vrf: default
#
# commands:
# - "logging console"
# - "logging ip access-list cache entries 4096"
# - "no logging ip access-list cache interval 200"
# - "no logging ip access-list cache threshold 5000"
# - "no logging origin-id hostname"
# - "logging origin-id ip 192.0.2.100"
# - "logging server 198.51.100.101 1 port 6538 use-vrf management"
# - "no logging server 203.0.113.100 1 use-vrf management"
#
# after:
# facilities:
# - facility: auth
# severity: critical
# - facility: ftp
# severity: informational
# - facility: ospfv3
# severity: alert
# ip:
# access_list:
# cache:
# entries: 4096
# monitor:
# severity: warning
# origin_id:
# ip: 192.0.2.100
# hosts:
# - severity: alert
# port: 6538
# host: 198.51.100.101
# use_vrf: management
# - facility: local6
# severity: error
# host: 203.0.113.101
# use_vrf: default
#
# After state:
# ------------
# nxos-9k-rdo# show running-config | include logging
# logging monitor 4
# logging ip access-list cache entries 4096
# logging severity auth 2
# logging severity ospfv3 1
# logging severity ftp 6
# logging origin-id ip 192.0.2.100
# logging server 203.0.113.101 3 use-vrf default facility local6
# logging server 198.51.100.101 1 port 6538 use-vrf management
# Using deleted to delete all logging configurations
# Before state:
# ------------
# nxos-9k-rdo# show running-config | include logging
# logging console 3
# logging monitor 4
# logging ip access-list cache entries 16384
# logging ip access-list cache interval 200
# logging ip access-list cache threshold 5000
# logging severity auth 2
# logging severity ospfv3 1
# logging severity ftp 6
# logging origin-id hostname
# logging server 203.0.113.100 1 use-vrf management
# logging server 203.0.113.101 3 use-vrf default facility local6
- name: Delete all logging configuration
cisco.nxos.nxos_logging_global:
state: deleted
# Task output
# -------------
# before:
# console:
# severity: error
# facilities:
# - facility: auth
# severity: critical
# - facility: ftp
# severity: informational
# - facility: ospfv3
# severity: alert
# ip:
# access_list:
# cache:
# entries: 16384
# interval: 200
# threshold: 5000
# monitor:
# severity: warning
# origin_id:
# hostname: true
# hosts:
# - severity: alert
# host: 203.0.113.100
# use_vrf: management
# - facility: local6
# severity: error
# host: 203.0.113.101
# use_vrf: default
#
# commands:
# - "logging console"
# - "logging monitor"
# - "no logging ip access-list cache entries 16384"
# - "no logging ip access-list cache interval 200"
# - "no logging ip access-list cache threshold 5000"
# - "no logging origin-id hostname"
# - "no logging severity auth 2"
# - "no logging severity ospfv3 1"
# - "no logging severity ftp 6"
# - "no logging server 203.0.113.100 1 use-vrf management"
# - "no logging server 203.0.113.101 3 facility local6 use-vrf default"
#
# after: {}
# Using rendered
- name: Render platform specific configuration lines with state rendered (without connecting to the device)
cisco.nxos.nxos_logging_global:
config:
console:
severity: error
monitor:
severity: warning
ip:
access_list:
cache:
entries: 16384
interval: 200
threshold: 5000
facilities:
- facility: auth
severity: critical
- facility: ospfv3
severity: alert
- facility: ftp
severity: informational
hosts:
- host: 203.0.113.100
severity: alert
use_vrf: management
- host: 203.0.113.101
severity: error
facility: local6
use_vrf: default
origin_id:
hostname: true
# Task Output (redacted)
# -----------------------
# rendered:
# - "logging console 3"
# - "logging monitor 4"
# - "logging ip access-list cache entries 16384"
# - "logging ip access-list cache interval 200"
# - "logging ip access-list cache threshold 5000"
# - "logging severity auth 2"
# - "logging severity ospfv3 1"
# - "logging severity ftp 6"
# - "logging server 203.0.113.100 1 use-vrf management"
# - "logging server 203.0.113.101 3 facility local6 use-vrf default"
# - "logging origin-id hostname"
# Using parsed
# parsed.cfg
# ------------
# logging console 3
# logging monitor 4
# logging ip access-list cache entries 16384
# logging ip access-list cache interval 200
# logging ip access-list cache threshold 5000
# logging severity auth 2
# logging severity ospfv3 1
# logging severity ftp 6
# logging origin-id hostname
# logging server 203.0.113.100 1 use-vrf management
# logging server 203.0.113.101 3 use-vrf default facility local6
- name: Parse externally provided logging configuration
cisco.nxos.nxos_logging_global:
running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}"
state: parsed
# Task output (redacted)
# -----------------------
# parsed:
# console:
# severity: error
# facilities:
# - facility: auth
# severity: critical
# - facility: ftp
# severity: informational
# - facility: ospfv3
# severity: alert
# ip:
# access_list:
# cache:
# entries: 16384
# interval: 200
# threshold: 5000
# monitor:
# severity: warning
# origin_id:
# hostname: true
# hosts:
# - severity: alert
# host: 203.0.113.100
# use_vrf: management
# - facility: local6
# severity: error
# host: 203.0.113.101
# use_vrf: default
返回值
常见的返回值在此处记录 此处,以下是此模块独有的字段
键 |
描述 |
---|---|
模块执行后的结果配置。 返回值: 当更改时 示例: |
|
模块执行之前的配置。 返回值: 当状态为 *merged*、*replaced*、*overridden*、*deleted* 或 *purged* 时 示例: |
|
推送到远程设备的一组命令。 返回值: 当状态为 *merged*、*replaced*、*overridden*、*deleted* 或 *purged* 时 示例: |
|
从远程设备收集的网络资源的事实,以结构化数据的形式呈现。 返回: 当状态为 已收集 时 示例: |
|
在 running_config 选项中提供的设备原生配置,按照模块 argspec 解析为结构化数据。 返回: 当状态为 已解析 时 示例: |
|
任务中提供的配置以设备原生格式渲染(离线)。 返回: 当状态为 已渲染 时 示例: |