community.general.syslogger module – Log messages in the syslog

Note

This module is part of the community.general collection (version 9.5.1).

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.general.

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

Synopsis

  • Uses syslog to add log entries to the host.

Parameters

Parameter

Comments

facility

string

Set the log facility.

Choices:

  • "kern"

  • "user"

  • "mail"

  • "daemon" ← (default)

  • "auth"

  • "lpr"

  • "news"

  • "uucp"

  • "cron"

  • "syslog"

  • "local0"

  • "local1"

  • "local2"

  • "local3"

  • "local4"

  • "local5"

  • "local6"

  • "local7"

ident

string

added in community.general 0.2.0

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

Default: "ansible_syslogger"

log_pid

boolean

Log the PID in brackets.

Choices:

  • false ← (default)

  • true

msg

string / required

This is the message to place in syslog.

priority

string

Set the log priority.

Choices:

  • "emerg"

  • "alert"

  • "crit"

  • "err"

  • "warning"

  • "notice"

  • "info" ← (default)

  • "debug"

Attributes

Attribute

Support

Description

check_mode

Support: none

Can run in check_mode and return changed status prediction without modifying target.

diff_mode

Support: none

Will return details on what has changed (or possibly needs changing in check_mode), when in diff mode.

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

Description

facility

string

Syslog facility

Returned: always

Sample: "info"

ident

string

added in community.general 0.2.0

Name of application sending the message to log

Returned: always

Sample: "ansible_syslogger"

log_pid

boolean

Log PID status

Returned: always

Sample: true

msg

string

Message sent to syslog

Returned: always

Sample: "Hello from Ansible"

priority

string

Priority level

Returned: always

Sample: "daemon"

Authors

  • Tim Rightnour (@garbled1)