From ba8b4e8c2963548f6f2eb4abe81cee02a546e456 Mon Sep 17 00:00:00 2001 From: Jeltz Date: Mon, 1 Mar 2021 02:11:29 +0100 Subject: [PATCH] Fix the ordering of rsyslog.d files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A call to sendLogsToRemote for logs received through RELP/UDP has been added (to send them to Logstash/Redis/…), so common.conf's prefix must be lower than collector.conf's. Note: future "third-party" config files will also call sendLogsToRemote and thus will also have to use a prefix higher than 10. --- roles/rsyslog_collector/tasks/main.yml | 4 ++-- .../templates/{10-collector.conf.j2 => 20-collector.conf.j2} | 2 ++ roles/rsyslog_common/tasks/main.yml | 4 ++-- .../templates/{99-common.conf.j2 => 10-common.conf.j2} | 0 4 files changed, 6 insertions(+), 4 deletions(-) rename roles/rsyslog_collector/templates/{10-collector.conf.j2 => 20-collector.conf.j2} (97%) rename roles/rsyslog_common/templates/{99-common.conf.j2 => 10-common.conf.j2} (100%) diff --git a/roles/rsyslog_collector/tasks/main.yml b/roles/rsyslog_collector/tasks/main.yml index d0487e6..0ee20a2 100644 --- a/roles/rsyslog_collector/tasks/main.yml +++ b/roles/rsyslog_collector/tasks/main.yml @@ -15,8 +15,8 @@ - name: Deploy rsyslog input configuration file become: true template: - src: 10-collector.conf.j2 - dest: /etc/rsyslog.d/10-collector.conf + src: 20-collector.conf.j2 + dest: /etc/rsyslog.d/20-collector.conf owner: root group: root mode: u=rw,g=r,o=r diff --git a/roles/rsyslog_collector/templates/10-collector.conf.j2 b/roles/rsyslog_collector/templates/20-collector.conf.j2 similarity index 97% rename from roles/rsyslog_collector/templates/10-collector.conf.j2 rename to roles/rsyslog_collector/templates/20-collector.conf.j2 index 793e519..a67956b 100644 --- a/roles/rsyslog_collector/templates/10-collector.conf.j2 +++ b/roles/rsyslog_collector/templates/20-collector.conf.j2 @@ -49,5 +49,7 @@ input( {% endif %} port="{{ input.port }}" ruleset="handleIncomingLogs" + + call sendLogsToRemote ) {% endfor %} diff --git a/roles/rsyslog_common/tasks/main.yml b/roles/rsyslog_common/tasks/main.yml index 9e1c7eb..ce0d35a 100644 --- a/roles/rsyslog_common/tasks/main.yml +++ b/roles/rsyslog_common/tasks/main.yml @@ -28,8 +28,8 @@ loop: - src: rsyslog.conf.j2 dest: /etc/rsyslog.conf - - src: 99-common.conf.j2 - dest: /etc/rsyslog.d/99-common.conf + - src: 10-common.conf.j2 + dest: /etc/rsyslog.d/10-common.conf notify: Restart rsyslog - name: Create journald.conf.d directory diff --git a/roles/rsyslog_common/templates/99-common.conf.j2 b/roles/rsyslog_common/templates/10-common.conf.j2 similarity index 100% rename from roles/rsyslog_common/templates/99-common.conf.j2 rename to roles/rsyslog_common/templates/10-common.conf.j2