junos_logging - Manage logging on network devices

New in version 2.4.

Synopsis

  • This module provides declarative management of logging on Juniper JUNOS devices.

Requirements (on host that executes module)

  • ncclient (>=v0.5.2)

Options

parameter required default choices comments
active
no True
  • True
  • False
Specifies whether or not the configuration is active or deactivated
aggregate
no
List of logging definitions.
dest
no
  • console
  • host
  • file
  • user
Destination of the logs.
facility
no
Set logging facility.
files
no
Number of files to be archived, this is applicable if value of dest is file. The acceptable value is in range from 1 to 1000.
level
no
Set logging severity levels.
name
no
If value of dest is file it indicates file-name, for user it indicates username and for host indicates the host name to be notified.
rotate_frequency
no
Rotate log frequency in minutes, this is applicable if value of dest is file. The acceptable value is in range of 1 to 59. This controls the frequency after which log file is rotated.
size
no
Size of the file in archive, this is applicable if value of dest is file. The acceptable value is in range from 65536 to 1073741824 bytes.
state
no present
  • present
  • absent
State of the logging configuration.

Examples

- name: configure console logging
  junos_logging:
    dest: console
    facility: any
    level: critical

- name: remove console logging configuration
  junos_logging:
    dest: console
    state: absent

- name: configure file logging
  junos_logging:
    dest: file
    name: test
    facility: pfe
    level: error

- name: configure logging parameter
  junos_logging:
    files: 30
    size: 65536
    rotate_frequency: 10

- name: Configure file logging using aggregate
  junos_logging:
    dest: file
    aggregate:
    - name: test-1
      facility: pfe
      level: critical
    - name: test-2
      facility: kernel
      level: emergency
    active: True

- name: Delete file logging using aggregate
  junos_logging:
    aggregate:
    - { dest: file, name: test-1,  facility: pfe, level: critical }
    - { dest: file, name: test-2,  facility: kernel, level: emergency }
    state: absent

Return Values

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

name description returned type sample
diff.prepared
Configuration difference before and after applying change.
when configuration is changed and diff option is enabled. string [edit system syslog] + [edit system syslog] file interactive-commands { ... } + file test { + pfe critical; + }

Notes

Note

  • This module requires the netconf system service be enabled on the remote device being managed.
  • Tested against vSRX JUNOS version 15.1X49-D15.4, vqfx-10000 JUNOS Version 15.1X53-D60.4.

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance Info

For more information about Red Hat’s this support of this module, please refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/junos_logging_module.html