https://github.com/oefenweb/ansible-rsyslog
Ansible role to manage rsyslog and rsyslog.d in Debian-like systems
https://github.com/oefenweb/ansible-rsyslog
Last synced: 6 months ago
JSON representation
Ansible role to manage rsyslog and rsyslog.d in Debian-like systems
- Host: GitHub
- URL: https://github.com/oefenweb/ansible-rsyslog
- Owner: Oefenweb
- License: mit
- Created: 2015-11-24T11:37:12.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2026-01-21T13:01:51.000Z (6 months ago)
- Last Synced: 2026-01-22T00:27:15.175Z (6 months ago)
- Language: Jinja
- Size: 103 KB
- Stars: 12
- Watchers: 2
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
## rsyslog
[](https://github.com/Oefenweb/ansible-rsyslog/actions?query=workflow%3ACI)
[](https://galaxy.ansible.com/Oefenweb/rsyslog)
Manage rsyslog and rsyslog.d in Debian-like systems.
#### Requirements
None
#### Variables
* `rsyslog_apparmor_extend_profile`: [default: `true`]: Whether to extend the default `usr.sbin.rsyslogd` profile to make validation work (in most cases)
* `rsyslog_apparmor_utils_install`: [default: `false`]: Whether to install apparmor-utils or not
* `rsyslog_apparmor_debug`: [default: `false`]: Whether to show more apparmor debugging output
* `rsyslog_apparmor_profile_local_content`: [default: `[]`]: Additional file content of the extended `usr.sbin.rsyslogd` profile (e.g. `/var/lib/haproxy/dev/log rwl,`)
* `rsyslog_global_config_file_validate`: [default: `true`]: Whether the global configuration should be validated before it is applied
* `rsyslog_repeated_msg_reduction`: [default: `true`]: Repeated message reduction
* `rsyslog_file_owner`: [default: `syslog`, `root` on Debian]: Set the file owner for dynaFiles newly created
* `rsyslog_file_group`: [default: `adm`]: Set the file group for dynaFiles newly created
* `rsyslog_file_create_mode`: [default: `0640`]: The creation mode with which rsyslogd creates new files
* `rsyslog_dir_create_mode`: [default: `0755`]: The creation mode with which rsyslogd creates new directories
* `rsyslog_umask`: [default: `0022`]: The default rsyslogd processes' umask
* `rsyslog_priv_drop_to_user`: [default: `syslog`, not used on Debian]: Name of the user rsyslog should run under after startup
* `rsyslog_priv_drop_to_group`: [default: `syslog`, not used on Debian]: Name of the group rsyslog should run under after startup
* `rsyslog_rsyslog_d_files` [default: `{}`]: `/etc/rsyslog.d/*` file(s) declarations
* `rsyslog_rsyslog_d_files.key`: The name of the rsyslog configuration file (e.g `50-default`)
* `rsyslog_rsyslog_d_files.key.state` [default: `present`]: State
* `rsyslog_rsyslog_d_files.key.validate` [default: `true`]: Whether this configuration should be validated before it is applied
* `rsyslog_rsyslog_d_files.key.settings` [default: `[]`]: Settings declarations
* `rsyslog_rsyslog_d_files.key.rules` [default: `{}`]: Rule declarations
* `rsyslog_rsyslog_d_files.key.rules.{n}.rule` [required]: Rule declaration
* `rsyslog_rsyslog_d_files.key.rules.{n}.logpath` [required]: Path of the log file
* `rsyslog_rsyslog_d_files.key.directives` [default: `[]`]: Directive declarations
## Dependencies
None
#### Example(s)
##### Simple configuration
```yaml
---
- hosts: all
roles:
- oefenweb.rsyslog
```
##### Complex configuration
```yaml
---
- hosts: all
roles:
- oefenweb.rsyslog
vars:
rsyslog_repeated_msg_reduction: true
rsyslog_file_owner: syslog
rsyslog_file_group: adm
rsyslog_file_create_mode: '0640'
rsyslog_dir_create_mode: '0755'
rsyslog_umask: '0022'
rsyslog_priv_drop_to_user: syslog
rsyslog_priv_drop_to_group: syslog
rsyslog_rsyslog_d_files:
20-ufw:
rules:
- rule: ':msg,contains,"[UFW "'
logpath: '/var/log/ufw.log'
postfix: "{{ rsyslog_rsyslog_d_presets_postfix | combine(rsyslog_rsyslog_d_presets_validate_false) }}"
49-haproxy:
settings:
# Create an additional socket in haproxy's chroot in order to allow logging via
# /dev/log to chroot'ed HAProxy processes
- '$AddUnixListenSocket /var/lib/haproxy/dev/log'
rules:
# Send HAProxy messages to a dedicated logfile
- rule: ':programname, startswith, "haproxy"'
logpath: '/var/log/haproxy.log'
directives:
- '&~'
validate: false
```
#### License
MIT
#### Author Information
* Mark van Driel
* Mischa ter Smitten
#### Feedback, bug-reports, requests, ...
Are [welcome](https://github.com/Oefenweb/ansible-rsyslog/issues)!