Merge "Configure logrotate for WSGI logs"

This commit is contained in:
Jenkins 2016-10-25 14:33:31 +00:00 committed by Gerrit Code Review
commit 50b6b19758
3 changed files with 43 additions and 3 deletions

View File

@ -133,16 +133,34 @@ class nagios::cgi (
apache::custom_config { 'nagios-ui':
content => template("nagios/${nagios::params::apache_ui_vhost_config_tpl}"),
verify_command => $verify_command,
notify => Class['apache::service'],
require => Class['apache'],
}
if $wsgi_vhost_listen_ip {
$log_dir = "${nagios::params::data_dir}/log"
file { $log_dir:
ensure => directory,
mode => '0650',
require => Class['apache'],
notify => Class['apache::service'],
}
$logrotate_conf = '/etc/logrotate.d/nagios_wsgi.conf'
file { $logrotate_conf:
ensure => present,
content => template('nagios/logrotate.conf.erb'),
owner => 'root',
group => 'root',
mode => '0644',
require => File[$log_dir],
}
# Template uses these variables: cgi_htpasswd_file
# nagios_command_file, wsgi_vhost_listen_ip, wsgi_processes, wsgi_threads,
# wsgi_process_service_checks_script, wsgi_process_service_checks_location
# log_dir
apache::custom_config { 'nagios-wsgi':
content => template("nagios/${nagios::params::apache_wsgi_vhost_config_tpl}"),
verify_command => $verify_command,
require => Class['apache'],
require => [Class['apache'], File[$log_dir]],
}
file { 'wsgi_process_service_checks_script':
ensure => present,

View File

@ -25,7 +25,7 @@
require valid-user
</Location>
ErrorLog "/var/log/apache2/nagios_wsgi_error.log"
ErrorLog "<%= @log_dir %>/nagios_wsgi_error.log"
ServerSignature Off
CustomLog "/var/log/apache2/nagios_wsgi_access.log" combined
CustomLog "<%= @log_dir %>/nagios_wsgi_access.log" combined
</VirtualHost>

View File

@ -0,0 +1,22 @@
# managed by puppet
<%= @log_dir %>/*.log {
# use the copytruncate option to avoid restarting Apache
copytruncate
compress
delaycompress
missingok
notifempty
# logrotate allows to use only year, month, day and unix epoch
dateext
dateformat -%Y%m%d-%s
# number of rotated files to keep
rotate 10
# do not rotate files unless both size and time conditions are met
hourly
minsize 20M
# force rotate if filesize exceeded 100M
maxsize 100M
# this must map the /var/log directory group ownership
su root syslog
}