From 70987c80c1212e0ad50c4a7600cbf1665f673cc2 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Wed, 2 Aug 2017 15:42:38 +0200 Subject: 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 --- templates/logrotate/containers_logrotate.conf.erb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 templates/logrotate/containers_logrotate.conf.erb (limited to 'templates') 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 +} -- cgit 1.2.3-korg