summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorBogdan Dobrelya <bdobreli@redhat.com>2017-08-02 15:42:38 +0200
committerBogdan Dobrelya <bdobreli@redhat.com>2017-08-16 09:42:54 +0200
commit70987c80c1212e0ad50c4a7600cbf1665f673cc2 (patch)
tree55da5db5e4dd9f6e00e5c062b4a145e37a19b6e0 /templates
parent1b82fe40fe53572703854fcdbeda72cdf148e9c1 (diff)
Add logrotate-crond configuration
Generate a cron job and a config for logrotate to be run against containerized services logs. Related-bug: #1700912 Change-Id: Ib9d5d8ca236296179182613e1ff625deea168614 Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
Diffstat (limited to 'templates')
-rw-r--r--templates/logrotate/containers_logrotate.conf.erb14
1 files changed, 14 insertions, 0 deletions
diff --git a/templates/logrotate/containers_logrotate.conf.erb b/templates/logrotate/containers_logrotate.conf.erb
new file mode 100644
index 0000000..cbf17b4
--- /dev/null
+++ b/templates/logrotate/containers_logrotate.conf.erb
@@ -0,0 +1,14 @@
+/var/log/containers/*/*.log {
+ rotate <%= @rotate %>
+ size <%= @size %>
+ missingok
+ notifempty
+<%- if @delaycompress %>
+ delaycompress
+<%- end %>
+ postrotate
+ /sbin/lsof -nPs +L1 +D /var/log 2>&1|\
+ /bin/perl -ne '/\S+\s+(\d+).*\/var\/log\/.*\(deleted\)/ && print "$1\n"' |\
+ /bin/xargs -n1 -r -t kill -HUP
+ endscript
+}