community.network.cnos_logging module – Manage logging on network devices

Note

This module is part of the community.network collection (version 5.0.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.network.

To use it in a playbook, specify: community.network.cnos_logging.

Synopsis

  • This module provides declarative management of logging on Cisco Cnos devices.

Parameters

Parameter

Comments

aggregate

string

List of logging definitions.

dest

string

Destination of the logs. Lenovo uses the term server instead of host in its CLI.

Choices:

  • "server"

  • "console"

  • "monitor"

  • "logfile"

facility

string

Set logging facility. This is applicable only for server logging

level

string

Set logging severity levels. 0-emerg;1-alert;2-crit;3-err;4-warn; 5-notif;6-inform;7-debug

Default: 5

name

string

If value of dest is file it indicates file-name and for server indicates the server name to be notified.

size

string

Size of buffer. The acceptable value is in range from 4096 to 4294967295 bytes.

Default: 10485760

state

string

State of the logging configuration.

Choices:

  • "present" ← (default)

  • "absent"

Notes

Note

  • Tested against CNOS 10.9.1

Examples

- name: Configure server logging
  community.network.cnos_logging:
    dest: server
    name: 10.241.107.224
    facility: local7
    state: present

- name: Remove server logging configuration
  community.network.cnos_logging:
    dest: server
    name: 10.241.107.224
    state: absent

- name: Configure console logging level and facility
  community.network.cnos_logging:
    dest: console
    level: 7
    state: present

- name: Configure buffer size
  community.network.cnos_logging:
    dest: logfile
    level: 5
    name: testfile
    size: 5000

- name: Configure logging using aggregate
  community.network.cnos_logging:
    aggregate:
      - { dest: console, level: 6 }
      - { dest: logfile, size: 9000 }

- name: Remove logging using aggregate
  community.network.cnos_logging:
    aggregate:
      - { dest: console, level: 6 }
      - { dest: logfile, name: anil, size: 9000 }
    state: absent

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

commands

list / elements=string

The list of configuration mode commands to send to the device

Returned: always

Sample: ["logging console 7", "logging server 10.241.107.224"]

Authors

  • Anil Kumar Muraleedharan (@amuraleedhar)