puppet-tripleo/templates/logrotate/containers_logrotate.conf.erb

30 lines
912 B
Plaintext

/var/log/containers/*/*log /var/log/containers/*/*/*log {
<%= @rotation %>
rotate <%= @rotate %>
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
# Do not use size as it's not compatible with time-based rotation rules
# required for GDPR compliance.
maxsize <%= @maxsize %>
missingok
notifempty
<%- if @delaycompress %>
delaycompress
<%- end %>
<%- if @compress %>
compress
<%- end %>
sharedscripts
postrotate
/usr/bin/find /var/log/containers -type f \
\( -mtime +<%= @purge_after_days %> -or \
-atime +<%= @purge_after_days %> -or \
-ctime +<%= @purge_after_days %> \) -exec rm -f {} \;;
/sbin/lsof -nPs +L1 +D /var/log 2>&1|\
awk '/\S+\s+[0-9]+\s.*\/var\/log\/.*\(deleted\)/ {print $2}' |\
/bin/xargs -n1 -r -t kill -HUP
endscript
}