Ansible Role rsyslog
This role installs and configures rsyslog. Useful for configuring log forwarding, for example to a Graylog server.
Optional Role Variables
Variable |
Description |
Default Value |
---|---|---|
|
A list of rsyslog configs that should be deployed to
host_vars / group_vars (can only be used in one group at a time). |
|
|
Enables or disables the rsyslog service, analogous to |
|
|
Changes the state of the rsyslog service, analogous to |
|
Example:
# optional
rsyslog__conf__group_var: []
rsyslog__conf__host_var:
- filename: 'my-old-config'
state: 'absent'
- filename: 'graylog'
comment: |-
Relay logs to Graylog
state: 'present'
template: 'raw'
raw: |-
# rsyslog v7 filter conditions:
# contains isequal startswith regex ereregex
# http://www.rsyslog.com/doc/v7-stable/configuration/filters.html
if (
$msg startswith "GSSAPI client step " or
$msg startswith "GSSAPI server step " or
($programname == "kernel" and $msg startswith "RULE ") or
($programname == "systemd" and ($msg startswith "Created slice " or $msg startswith "Removed slice ")) or
($programname == "systemd" and ($msg startswith "Starting user-" or $msg startswith "Stopping user-")) or
($programname == "systemd" and ($msg startswith "Starting Session " or $msg startswith "Started Session ")) or
($programname == "systemd-logind" and ($msg startswith "New Session " or $msg startswith "Removed Session "))
)
then
# ignore, do not foward
continue
else
*.* @graylog.example.com:1514;RSYSLOG_SyslogProtocol23Format
rsyslog__service_enabled: true
rsyslog__service_state: 'started'