Rotate zuul logs with logrotate

Python logrotate does not compress. Use logrotate utility to do log
rotation so that older logs can be compressed saving disk space.

Change python logging to use normal file handlers as it will no longer
be doing the rotation for us. Keep all the file names the same.

Change-Id: I7302e4b197e99fd49fd9d5678702333b17a46efa
This commit is contained in:
Clark Boylan 2014-05-27 14:20:40 -07:00
parent 4ba2f8fc26
commit d24db3384c
2 changed files with 64 additions and 0 deletions

View File

@ -33,4 +33,30 @@ class zuul::merger (
require => [User['zuul'],
File['/var/lib/zuul/git']],
}
include logrotate
logrotate::file { 'merger.log':
log => '/var/log/zuul/merger.log',
options => [
'compress',
'copytruncate',
'missingok',
'rotate 30',
'daily',
'notifempty',
],
require => Service['zuul-merger'],
}
logrotate::file { 'merger-debug.log':
log => '/var/log/zuul/merger-debug.log',
options => [
'compress',
'copytruncate',
'missingok',
'rotate 30',
'daily',
'notifempty',
],
require => Service['zuul-merger'],
}
}

View File

@ -29,4 +29,42 @@ class zuul::server (
require => File['/etc/init.d/zuul'],
refreshonly => true,
}
include logrotate
logrotate::file { 'zuul.log':
log => '/var/log/zuul/zuul.log',
options => [
'compress',
'copytruncate',
'missingok',
'rotate 30',
'daily',
'notifempty',
],
require => Service['zuul'],
}
logrotate::file { 'zuul-debug.log':
log => '/var/log/zuul/debug.log',
options => [
'compress',
'copytruncate',
'missingok',
'rotate 30',
'daily',
'notifempty',
],
require => Service['zuul'],
}
logrotate::file { 'gearman-server.log':
log => '/var/log/zuul/gearman-server.log',
options => [
'compress',
'copytruncate',
'missingok',
'rotate 7',
'daily',
'notifempty',
],
require => Service['zuul'],
}
}