Deprecated

Removed in None

i

Reason:Updated module released with more functionality. | Alternative:nxos_logging_global

cisco.nxos.nxos_logging (6.0.3) — module

Manage logging on network devices

| "added in version" 1.0.0 of cisco.nxos"

Authors: Trishna Guha (@trishnaguha)

Install collection

Install with ansible-galaxy collection install cisco.nxos:==6.0.3


Add to requirements.yml

  collections:
    - name: cisco.nxos
      version: 6.0.3

Description

This module provides declarative management of logging on Cisco NX-OS devices.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure console logging with level
  cisco.nxos.nxos_logging:
    dest: console
    level: 2
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove console logging configuration
  cisco.nxos.nxos_logging:
    dest: console
    level: 2
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure file logging with level
  cisco.nxos.nxos_logging:
    dest: logfile
    name: testfile
    dest_level: 3
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure logging logfile with size
  cisco.nxos.nxos_logging:
    dest: logfile
    name: testfile
    dest_level: 3
    file_size: 16384
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure facility level logging
  cisco.nxos.nxos_logging:
    facility: daemon
    facility_level: 0
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove facility level logging
  cisco.nxos.nxos_logging:
    facility: daemon
    facility_level: 0
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure Remote Logging
  cisco.nxos.nxos_logging:
    dest: server
    remote_server: test-syslogserver.com
    facility: auth
    facility_level: 1
    use_vrf: management
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure Source Interface for Logging
  cisco.nxos.nxos_logging:
    interface: mgmt0
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Purge nxos_logging configuration not managed by this playbook
  cisco.nxos.nxos_logging:
    purge: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure logging timestamp
  cisco.nxos.nxos_logging:
    timestamp: milliseconds
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure logging facility ethpm link status
  cisco.nxos.nxos_logging:
    facility: ethpm
    facility_link_status: link-up-notif
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure logging message ethernet description
  cisco.nxos.nxos_logging:
    interface_message: add-interface-description
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure logging event link enable
  cisco.nxos.nxos_logging:
    event: link-enable
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure logging using aggregate
  cisco.nxos.nxos_logging:
    aggregate:
      - {dest: console, dest_level: 2}
      - {dest: logfile, dest_level: 2, name: testfile}
      - {facility: daemon, facility_level: 0}
    state: present

Inputs

    
dest:
    choices:
    - console
    - logfile
    - module
    - monitor
    - server
    description:
    - Destination of the logs.
    type: str

name:
    description:
    - If value of C(dest) is I(logfile) it indicates file-name.
    type: str

event:
    choices:
    - link-enable
    - link-default
    - trunk-enable
    - trunk-default
    description:
    - Link/trunk enable/default interface configuration logging
    type: str

purge:
    default: false
    description:
    - Remove any switch logging configuration that does not match what has been configured
      Not supported for ansible_connection local. All nxos_logging tasks must use the
      same ansible_connection type.
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the logging configuration.
    type: str

use_vrf:
    description:
    - VRF to be used while configuring remote logging (when dest is 'server').
    type: str

facility:
    description:
    - Facility name for logging.
    type: str

aggregate:
    description: List of logging definitions.
    elements: dict
    type: list

file_size:
    description:
    - Set logfile size
    type: int

interface:
    description:
    - Interface to be used while configuring source-interface for logging (e.g., 'Ethernet1/2',
      'mgmt0')
    type: str

timestamp:
    choices:
    - microseconds
    - milliseconds
    - seconds
    description:
    - Set logging timestamp format
    type: str

dest_level:
    aliases:
    - level
    description:
    - Set logging severity levels.
    type: int

remote_server:
    description:
    - Hostname or IP Address for remote logging (when dest is 'server').
    type: str

facility_level:
    description:
    - Set logging severity levels for facility based log messages.
    type: int

interface_message:
    choices:
    - add-interface-description
    description:
    - Add interface description to interface syslogs. Does not work with version 6.0 images
      using nxapi as a transport.
    type: str

facility_link_status:
    choices:
    - link-down-notif
    - link-down-error
    - link-up-notif
    - link-up-error
    description:
    - Set logging facility ethpm link status. Not idempotent with version 6.0 images.
    type: str

Outputs

commands:
  description: The list of configuration mode commands to send to the device
  returned: always
  sample:
  - logging console 2
  - logging logfile testfile 3
  - logging level daemon 0
  type: list