Merge "Fix containerized logrotate configuration"
This commit is contained in:
commit
451e76b5f8
@ -50,6 +50,10 @@
|
||||
# [*user*]
|
||||
# (optional) Defaults to 'root'. Configures cron job for logrotate.
|
||||
#
|
||||
# [*copytruncate*]
|
||||
# (optional) Defaults to True.
|
||||
# Configures the logrotate copytruncate parameter.
|
||||
#
|
||||
# [*delaycompress*]
|
||||
# (optional) Defaults to True.
|
||||
# Configures the logrotate delaycompress parameter.
|
||||
@ -63,11 +67,11 @@
|
||||
# Configures the logrotate maxsize parameter.
|
||||
#
|
||||
# [*rotation*]
|
||||
# (optional) Defaults to 'daily'.
|
||||
# (optional) Defaults to 'hourly'.
|
||||
# Configures the logrotate rotation interval.
|
||||
#
|
||||
# [*rotate*]
|
||||
# (optional) Defaults to 14.
|
||||
# (optional) Defaults to 336 (corresponds to 14 days).
|
||||
# Configures the logrotate rotate parameter.
|
||||
#
|
||||
# [*purge_after_days*]
|
||||
@ -91,11 +95,12 @@ class tripleo::profile::base::logging::logrotate (
|
||||
$weekday = '*',
|
||||
Integer $maxdelay = 90,
|
||||
$user = 'root',
|
||||
$copytruncate = true,
|
||||
$delaycompress = true,
|
||||
$compress = true,
|
||||
$rotation = 'daily',
|
||||
$rotation = 'hourly',
|
||||
$maxsize = '10M',
|
||||
$rotate = 14,
|
||||
$rotate = 336,
|
||||
$purge_after_days = 14,
|
||||
# DEPRECATED PARAMETERS
|
||||
$size = undef,
|
||||
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Logrotate's copytruncate is used by default for containerized services logs
|
||||
rotation. The default period to keep old logs remains unchanged (14 days),
|
||||
but rotation will happen on hourly basis instead of daily. That means that
|
||||
old log files will be maintained for 336 versions of it, which represents
|
||||
14 days multiplied by 24 hours per a day.
|
||||
fixes:
|
||||
- |
|
||||
Containerized logrotate configuration ensures httpd processes running in
|
||||
containers will be reloaded gracefully via SIGUSR1. Containerized servicies
|
||||
will reliably reopen its logfiles when logrotate happens.
|
@ -10,6 +10,9 @@
|
||||
maxsize <%= @maxsize %>
|
||||
missingok
|
||||
notifempty
|
||||
<%- if @copytruncate %>
|
||||
copytruncate
|
||||
<%- end %>
|
||||
<%- if @delaycompress %>
|
||||
delaycompress
|
||||
<%- end %>
|
||||
@ -22,8 +25,11 @@
|
||||
\( -mtime +<%= @purge_after_days %> -or \
|
||||
-atime +<%= @purge_after_days %> -or \
|
||||
-ctime +<%= @purge_after_days %> \) -exec rm -f {} \;;
|
||||
/sbin/lsof -nPs +L1 +D /var/log/containers 2>&1|\
|
||||
awk '/\S+\s+[0-9]+\s.*\/var\/log\/containers\/.*\(deleted\)/ {print $2}' |\
|
||||
sort -u | /bin/xargs -n1 -r -t kill -HUP
|
||||
/sbin/lsof -nPs <%- if @copytruncate -%>+L1<%- end -%> +D /var/log/containers 2>&1|\
|
||||
awk '/\S+\s+[0-9]+\s.*\/var\/log\/containers\/<%- if @copytruncate -%>.*\(deleted\)<%- end -%>/ {print $2}' |\
|
||||
sort -u | grep -v httpd | /bin/xargs -n1 -r -t kill -HUP;
|
||||
/sbin/lsof -nPs <%- if @copytruncate -%>+L1<%- end -%> +D /var/log/containers/httpd 2>&1|\
|
||||
awk '/\S+\s+[0-9]+\s.*\/var\/log\/containers\/httpd\/<%- if @copytruncate -%>.*\(deleted\)<%- end -%>/ {print $2}' |\
|
||||
sort -u | /bin/xargs -n1 -r -t kill -USR1
|
||||
endscript
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user