community.general.syslogger – Log messages in the syslog

From Get docs
Ansible/docs/2.11/collections/community/general/syslogger module


community.general.syslogger – Log messages in the syslog

Note

This plugin is part of the community.general collection (version 2.0.1).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.syslogger.


Synopsis

  • Uses syslog to add log entries to the host.

Parameters

Parameter Choices/Defaults Comments

facility

string

  • kern
  • user
  • mail
  • daemon

  • auth
  • lpr
  • news
  • uucp
  • cron
  • syslog
  • local0
  • local1
  • local2
  • local3
  • local4
  • local5
  • local6
  • local7

Set the log facility.

ident

string

added in 0.2.0 of community.general

Default:

"ansible_syslogger"

Specify the name of application name which is sending the log to syslog.

log_pid

boolean

  • no

  • yes

Log the PID in brackets.

msg

string / required

This is the message to place in syslog.

priority

string

  • emerg
  • alert
  • crit
  • err
  • warning
  • notice
  • info

  • debug

Set the log priority.



Examples

- name: Simple Usage
  community.general.syslogger:
    msg: "I will end up as daemon.info"

- name: Send a log message with err priority and user facility with log_pid
  community.general.syslogger:
    msg: "Hello from Ansible"
    priority: "err"
    facility: "user"
    log_pid: true

- name: Specify the name of application which is sending log message
  community.general.syslogger:
    ident: "MyApp"
    msg: "I want to believe"
    priority: "alert"

Return Values

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

Key Returned Description

facility

string

always

Syslog facility


Sample:

info

ident

string

added in 0.2.0 of community.general

always

Name of application sending the message to log


Sample:

ansible_syslogger

log_pid

boolean

always

Log PID status


Sample:

True

msg

string

always

Message sent to syslog


Sample:

Hello from Ansible

priority

string

always

Priority level


Sample:

daemon




Authors

  • Tim Rightnour (@garbled1)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/community/general/syslogger_module.html