From f3317084df56efeb34ac98a44ccd6328ef9aedb8 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Fri, 4 May 2018 18:14:48 +0200 Subject: [PATCH] Add logrotate compress option Related bz: #1570039 Change-Id: Id07b7b53d31192a2d2172671b272a5b61dc8df52 Signed-off-by: Bogdan Dobrelya --- manifests/profile/base/logging/logrotate.pp | 5 +++++ .../logrotate-containers-compress-96934a4e76b9689d.yaml | 5 +++++ templates/logrotate/containers_logrotate.conf.erb | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 releasenotes/notes/logrotate-containers-compress-96934a4e76b9689d.yaml diff --git a/manifests/profile/base/logging/logrotate.pp b/manifests/profile/base/logging/logrotate.pp index 1545875dc..45f2a77df 100644 --- a/manifests/profile/base/logging/logrotate.pp +++ b/manifests/profile/base/logging/logrotate.pp @@ -54,6 +54,10 @@ # (optional) Defaults to True. # Configures the logrotate delaycompress parameter. # +# [*compress*] +# (optional) Defaults to True. +# Configures the logrotate compress parameter. +# # [*size*] # (optional) Defaults to '10M'. # Configures the logrotate size parameter. @@ -73,6 +77,7 @@ class tripleo::profile::base::logging::logrotate ( Integer $maxdelay = 90, $user = 'root', $delaycompress = true, + $compress = true, $size = '10M', $rotate = 14, ) { diff --git a/releasenotes/notes/logrotate-containers-compress-96934a4e76b9689d.yaml b/releasenotes/notes/logrotate-containers-compress-96934a4e76b9689d.yaml new file mode 100644 index 000000000..11765e3ec --- /dev/null +++ b/releasenotes/notes/logrotate-containers-compress-96934a4e76b9689d.yaml @@ -0,0 +1,5 @@ +--- +other: + - | + Add the compress option for the containerized logrotate service to + compress rotated logs by default. diff --git a/templates/logrotate/containers_logrotate.conf.erb b/templates/logrotate/containers_logrotate.conf.erb index f1ae91957..a666b0e35 100644 --- a/templates/logrotate/containers_logrotate.conf.erb +++ b/templates/logrotate/containers_logrotate.conf.erb @@ -5,6 +5,9 @@ notifempty <%- if @delaycompress %> delaycompress +<%- end %> +<%- if @compress %> + compress <%- end %> postrotate /sbin/lsof -nPs +L1 +D /var/log 2>&1|\