robertdebock / ansible-role-rsyslog

Install and configure rsyslog on your system.
https://robertdebock.nl/
Apache License 2.0
36 stars 40 forks source link

Add support for multiple remotes #47

Open lkirkwood opened 9 months ago

lkirkwood commented 9 months ago

Add support for multiple remotes

Description

This PR changes the forwarding rule templates to allow configuration of multiple remotes.

Changes

Removes the rsyslog_remote variable and replaces it with rsyslog_remotes, which is a list of maps. Each item in this list has the following fields, as documents in defaults/main.yml:

- selector: pattern matching logs to forward.
  hostname: hostname of server to forward to.
  port: port to forward to.
  tcp: whether to use tcp.

All three templates (legacy default, advanced default, and standalone forwarding rules) have been modified to use these new variables. In addition, some comments were changed to be clearer and more correct.

Notes

Will break existing forwarding. This could be avoided by restoring the old variables and allowing both to be used together. If breaking backwards compatibility is a dealbreaker I can update the PR to fix that.

Also, this is a dupe of #44 but that PR breaks forwarding rules in the default config files and doesn't work with the advanced format.