An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

## rsyslog

[![CI](https://github.com/Oefenweb/ansible-rsyslog/workflows/CI/badge.svg)](https://github.com/Oefenweb/ansible-rsyslog/actions?query=workflow%3ACI)
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-rsyslog-blue.svg)](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)!