From dc1c78e08a3972ea093be3909843d34df32635bf Mon Sep 17 00:00:00 2001 From: Ludovic Poujol Date: Fri, 22 Nov 2019 16:48:19 +0100 Subject: [PATCH] evolinux-base: Fix our zsyslog rotate config that doesn't work on Debian 10 I've noticed that some log files, especially /var/log/syslog were empty. After investigating, I've realized that it was happening after a log rotation by logrotate. The old mechanism, `invoke-rc.d rsyslog rotate` isn't working anymore on Debian 10. It will fail with a not so explicit message : [FAIL] Closing open files: rsyslogd failed! Long story short, it seems that the pid file (`/run/rsyslogd.pid`) isn't created any more, so start-stop-daemon as used by /etc/init.d/rsyslog will fail. Explaining the error message. Debian 10 rsyslog now brings `/usr/lib/rsyslog/rsyslog-rotate` that is used by logrotate. It will send the signal HUP the 'right' way, so rsyslog will be aware of the log rotation. Sadly, this script isn't present in Debian 9 nor 8, so the logrotate configuration for rsyslog is now a template, using the right command for the right version. --- CHANGELOG.md | 1 + evolinux-base/tasks/logs.yml | 6 ++++++ .../logs/logrotate.d/zsyslog => templates/logs/zsyslog.j2} | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) rename evolinux-base/{files/logs/logrotate.d/zsyslog => templates/logs/zsyslog.j2} (77%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32d2274b..dcacf270 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ The **patch** part changes incrementally at each release. * php: add missing handler for php7.3-fpm * roundcube: fix typo for roundcube vhost * tomcat: fix typo for default tomcat_version +* evolinux-base: Fix our zsyslog rotate config that doesn't work on Debian 10 ### Security diff --git a/evolinux-base/tasks/logs.yml b/evolinux-base/tasks/logs.yml index 101330b8..9c1f45e4 100644 --- a/evolinux-base/tasks/logs.yml +++ b/evolinux-base/tasks/logs.yml @@ -24,6 +24,12 @@ dest: /etc/logrotate.d/ when: evolinux_logs_logrotate_confs +- name: Copy rsyslog logrotate file + template: + src: logs/zsyslog.j2 + dest: /etc/logrotate.d/zsyslog + when: evolinux_logs_logrotate_confs + - name: Configure logrotate.conf replace: dest: /etc/logrotate.conf diff --git a/evolinux-base/files/logs/logrotate.d/zsyslog b/evolinux-base/templates/logs/zsyslog.j2 similarity index 77% rename from evolinux-base/files/logs/logrotate.d/zsyslog rename to evolinux-base/templates/logs/zsyslog.j2 index 016dcfa6..95a9de02 100644 --- a/evolinux-base/files/logs/logrotate.d/zsyslog +++ b/evolinux-base/templates/logs/zsyslog.j2 @@ -8,7 +8,11 @@ notifempty delaycompress compress postrotate +{% if ansible_distribution_major_version | version_compare('10', '>=') %} + /usr/lib/rsyslog/rsyslog-rotate +{% else %} invoke-rc.d rsyslog rotate > /dev/null +{% endif %} endscript /var/log/daemon.log @@ -32,4 +36,4 @@ endscript { daily rotate 365 -} \ No newline at end of file +}