Rotate Grafana logs
Fixes-bug: #1572930 Change-Id: I73eac6720c3e5d006b018c5d13c5c64267adb175
This commit is contained in:
parent
7550e8ed21
commit
f1c68cb8cc
@ -67,4 +67,13 @@ class lma_monitoring_analytics::grafana (
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
file { '/etc/logrotate.d/grafana.conf':
|
||||
ensure => present,
|
||||
content => template('lma_monitoring_analytics/logrotate.conf.erb'),
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
require => Class['::grafana'],
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ describe 'lma_monitoring_analytics::grafana', :type => :class do
|
||||
it { is_expected.to contain_package('grafana').with(
|
||||
:ensure => 'latest'
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_file('/etc/logrotate.d/grafana.conf') }
|
||||
end
|
||||
|
||||
describe 'db_host without port number' do
|
||||
|
@ -0,0 +1,22 @@
|
||||
# managed by puppet
|
||||
#
|
||||
# This configuration assumes that Grafana is configured to log here (which is
|
||||
# the default settled by the package)
|
||||
|
||||
/var/log/grafana/*.log {
|
||||
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
|
||||
}
|
Loading…
Reference in New Issue
Block a user