From c2899322dd96a3b18834cea0fd2f2dff418aeb45 Mon Sep 17 00:00:00 2001 From: Ryo Hayakawa Date: Sun, 21 Jun 2020 22:37:09 +0900 Subject: [PATCH] Enable to modify params of logrotate-crond.conf Parameters "minsize" and "notifempty" of /etc/logrotate-crond.conf in the container logrotate_crond should be changeable even if this doesn't comply with GDPR. This is because there might be users who don't want to comply with it for some reason such as their internal rule, testing purpose, etc. This patch adds the following Puppet hieradata. tripleo::profile::base::logging::logrotate::minsize (default: 1) tripleo::profile::base::logging::logrotate::notifempty (default: True) Change-Id: I623c711921cf7fe52f15cc1ba4a1dafb3c9479b7 Closes-Bug: #1884415 (cherry picked from commit f6f878d4b36540ecc8b99552d3f5d14d92d509df) --- manifests/profile/base/logging/logrotate.pp | 10 ++++++++++ templates/logrotate/containers_logrotate.conf.erb | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/manifests/profile/base/logging/logrotate.pp b/manifests/profile/base/logging/logrotate.pp index f66dda66e..172b560f5 100644 --- a/manifests/profile/base/logging/logrotate.pp +++ b/manifests/profile/base/logging/logrotate.pp @@ -62,10 +62,18 @@ # (optional) Defaults to True. # Configures the logrotate compress parameter. # +# [*minsize*] +# (optional) Defaults to '1'. +# Configures the logrotate minsize parameter. +# # [*maxsize*] # (optional) Defaults to '10M'. # Configures the logrotate maxsize parameter. # +# [*notifempty*] +# (optional) Defaults to True. +# Configures the logrotate notifempty parameter. +# # [*rotation*] # (optional) Defaults to 'daily'. # Configures the logrotate rotation interval. @@ -111,7 +119,9 @@ class tripleo::profile::base::logging::logrotate ( $delaycompress = true, $compress = true, $rotation = 'daily', + $minsize = 1, $maxsize = '10M', + $notifempty = true, $rotate = 14, $purge_after_days = 14, $dateext = undef, diff --git a/templates/logrotate/containers_logrotate.conf.erb b/templates/logrotate/containers_logrotate.conf.erb index a80ce6efa..d5a786700 100644 --- a/templates/logrotate/containers_logrotate.conf.erb +++ b/templates/logrotate/containers_logrotate.conf.erb @@ -4,12 +4,14 @@ maxage <%= @purge_after_days %> # minsize 1 is required for GDPR compliance, all files in # /var/log/containers not managed with logrotate will be purged! - minsize 1 + minsize <%= @minsize %> # Do not use size as it's not compatible with time-based rotation rules # required for GDPR compliance. maxsize <%= @maxsize %> missingok +<%- if @notifempty %> notifempty +<%- end %> <%- if @copytruncate %> copytruncate <%- end %>