From 86bbab75ae414f19305970e2aa8aaeb05e6990ae Mon Sep 17 00:00:00 2001 From: zsdc Date: Fri, 17 Dec 2021 16:41:50 +0200 Subject: logs: T3774: Optimization for logrotate configs * Added proper handling of default values from CLI. * Replaced rsyslog restart postrotate action to native `rsyslog-rotate` script. * Removed unnecessary checks for `None` instead `dict` - with default values the situation becomes impossible. * Fixed default value from 10 to 1 in the rsyslog CLI. --- data/templates/logs/logrotate/vyos-atop.tmpl | 4 ++-- data/templates/logs/logrotate/vyos-rsyslog.tmpl | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'data') diff --git a/data/templates/logs/logrotate/vyos-atop.tmpl b/data/templates/logs/logrotate/vyos-atop.tmpl index 444d1da36..2d078f379 100644 --- a/data/templates/logs/logrotate/vyos-atop.tmpl +++ b/data/templates/logs/logrotate/vyos-atop.tmpl @@ -2,12 +2,12 @@ daily dateext dateformat _%Y-%m-%d_%H-%M-%S - maxsize {{ max_size|default('10') }}M + maxsize {{ max_size }}M missingok nocompress nocreate nomail - rotate {{ rotate|default('10') }} + rotate {{ rotate }} prerotate # stop the service systemctl stop atop.service diff --git a/data/templates/logs/logrotate/vyos-rsyslog.tmpl b/data/templates/logs/logrotate/vyos-rsyslog.tmpl index 3af1bfd8e..f2e4d2ab2 100644 --- a/data/templates/logs/logrotate/vyos-rsyslog.tmpl +++ b/data/templates/logs/logrotate/vyos-rsyslog.tmpl @@ -3,11 +3,11 @@ missingok nomail notifempty - rotate {{ rotate|default('10') }} - size {{ max_size|default('1') }}M + rotate {{ rotate }} + size {{ max_size }}M postrotate - # restart rsyslog service - systemctl restart rsyslog.service + # inform rsyslog service about rotation + /usr/lib/rsyslog/rsyslog-rotate endscript } -- cgit v1.2.3