community.general.syslogger (8.5.0) — module

Log messages in the syslog

Authors: Tim Rightnour (@garbled1)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Uses syslog to add log entries to the host.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Simple Usage
  community.general.syslogger:
    msg: "I will end up as daemon.info"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Specify the name of application which is sending log message
  community.general.syslogger:
    ident: "MyApp"
    msg: "I want to believe"
    priority: "alert"

Inputs

    
msg:
    description:
    - This is the message to place in syslog.
    required: true
    type: str

ident:
    default: ansible_syslogger
    description:
    - Specify the name of application name which is sending the log to syslog.
    type: str
    version_added: 0.2.0
    version_added_collection: community.general

log_pid:
    default: false
    description:
    - Log the PID in brackets.
    type: bool

facility:
    choices:
    - kern
    - user
    - mail
    - daemon
    - auth
    - lpr
    - news
    - uucp
    - cron
    - syslog
    - local0
    - local1
    - local2
    - local3
    - local4
    - local5
    - local6
    - local7
    default: daemon
    description:
    - Set the log facility.
    type: str

priority:
    choices:
    - emerg
    - alert
    - crit
    - err
    - warning
    - notice
    - info
    - debug
    default: info
    description:
    - Set the log priority.
    type: str

Outputs

facility:
  description: Syslog facility
  returned: always
  sample: info
  type: str
ident:
  description: Name of application sending the message to log
  returned: always
  sample: ansible_syslogger
  type: str
  version_added: 0.2.0
  version_added_collection: community.general
log_pid:
  description: Log PID status
  returned: always
  sample: true
  type: bool
msg:
  description: Message sent to syslog
  returned: always
  sample: Hello from Ansible
  type: str
priority:
  description: Priority level
  returned: always
  sample: daemon
  type: str