Documentation
PLEASE NOTE: This document applies to latest version and not to the latest stable release v2.20
Documentation for other releases can be found by using the version selector in the top right of any doc page.syslog
Send messages to the system syslog daemon.
This module enables scripts to log messages to the system log daemon, useful for operational logging, debugging, and audit trails in container/IoT environments.
Attributes
check_mode:
support: none
Parameters
| Parameter | Required | Type | Values | Description |
|---|---|---|---|---|
| facility | string | auth authpriv cron daemon ftp kern local0 local1 local2 local3 local4 local5 local6 local7 lpr news syslog user uucp |
The syslog facility to use. | |
| ident | string | Program identifier to use in syslog messages. Defaults to the script name or “rash”. | ||
| msg | true | string | The message to log to syslog (required). | |
| pid | boolean | Include PID in the log message. | ||
| priority | string | debug info notice warning error crit alert emerg |
The priority/severity level of the message. |
Example
- name: Log a simple info message
syslog:
msg: "Script started"
- name: Log with custom facility and priority
syslog:
msg: "Critical system error"
facility: local0
priority: error
- name: Log with custom identifier
syslog:
msg: "Container startup complete"
ident: myapp
- name: Log daemon message with PID
syslog:
msg: "Service heartbeat"
facility: daemon
priority: info
ident: myservice
pid: true