Configure logrotate for WSGI logs
Change-Id: I1f0692d85c24687d3a51ee09ce082e3544fd7317 Closes-Bug: #1635222
This commit is contained in:
parent
9036dbf291
commit
7c3997b8b9
@ -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,
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user