Merge "Copytruncate containerized logrotate configuration"
This commit is contained in:
commit
c0f568ef97
@ -50,6 +50,10 @@
|
|||||||
# [*user*]
|
# [*user*]
|
||||||
# (optional) Defaults to 'root'. Configures cron job for logrotate.
|
# (optional) Defaults to 'root'. Configures cron job for logrotate.
|
||||||
#
|
#
|
||||||
|
# [*copytruncate*]
|
||||||
|
# (optional) Defaults to True.
|
||||||
|
# Configures the logrotate copytruncate parameter.
|
||||||
|
#
|
||||||
# [*delaycompress*]
|
# [*delaycompress*]
|
||||||
# (optional) Defaults to True.
|
# (optional) Defaults to True.
|
||||||
# Configures the logrotate delaycompress parameter.
|
# Configures the logrotate delaycompress parameter.
|
||||||
@ -91,6 +95,7 @@ class tripleo::profile::base::logging::logrotate (
|
|||||||
$weekday = '*',
|
$weekday = '*',
|
||||||
Integer $maxdelay = 90,
|
Integer $maxdelay = 90,
|
||||||
$user = 'root',
|
$user = 'root',
|
||||||
|
$copytruncate = true,
|
||||||
$delaycompress = true,
|
$delaycompress = true,
|
||||||
$compress = true,
|
$compress = true,
|
||||||
$rotation = 'daily',
|
$rotation = 'daily',
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
Logrotate's copytruncate is used by default for containerized services logs
|
||||||
|
rotation. The default period to keep old logs remains unchanged (14 days).
|
@ -1,4 +1,4 @@
|
|||||||
/var/log/containers/*/*log /var/log/containers/*/*/*log {
|
/var/log/containers/*/*log /var/log/containers/*/*/*log /var/log/containers/*/*err {
|
||||||
<%= @rotation %>
|
<%= @rotation %>
|
||||||
rotate <%= @rotate %>
|
rotate <%= @rotate %>
|
||||||
maxage <%= @purge_after_days %>
|
maxage <%= @purge_after_days %>
|
||||||
@ -10,6 +10,9 @@
|
|||||||
maxsize <%= @maxsize %>
|
maxsize <%= @maxsize %>
|
||||||
missingok
|
missingok
|
||||||
notifempty
|
notifempty
|
||||||
|
<%- if @copytruncate %>
|
||||||
|
copytruncate
|
||||||
|
<%- end %>
|
||||||
<%- if @delaycompress %>
|
<%- if @delaycompress %>
|
||||||
delaycompress
|
delaycompress
|
||||||
<%- end %>
|
<%- end %>
|
||||||
@ -22,12 +25,5 @@
|
|||||||
\( -mtime +<%= @purge_after_days %> -or \
|
\( -mtime +<%= @purge_after_days %> -or \
|
||||||
-atime +<%= @purge_after_days %> -or \
|
-atime +<%= @purge_after_days %> -or \
|
||||||
-ctime +<%= @purge_after_days %> \) -exec rm -f {} \;;
|
-ctime +<%= @purge_after_days %> \) -exec rm -f {} \;;
|
||||||
/sbin/lsof -nPs +L1 +D /var/log/containers 2>/dev/null|\
|
|
||||||
grep -v /var/log/httpd/ |\
|
|
||||||
awk '/\S+\s+[0-9]+\s.*\/var\/log\/.*\(deleted\)/ {print $2}' |\
|
|
||||||
sort -u | /bin/xargs -n1 -r -t kill -HUP;
|
|
||||||
/sbin/lsof -nPs +L1 +D /var/log/containers 2>/dev/null|\
|
|
||||||
awk '/\S+\s+[0-9]+\s.*\/var\/log\/httpd\/.*\(deleted\)/ {print $2}' |\
|
|
||||||
sort -u | /bin/xargs -n1 -r -t kill -USR1
|
|
||||||
endscript
|
endscript
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user