Rotate Kibana logs
Change-Id: I8b0c419c3cd67ffec20b0cd5ed733c6f057f1147
This commit is contained in:
parent
0c696459c9
commit
156cd78dec
|
@ -34,8 +34,12 @@ class lma_logging_analytics::kibana (
|
||||||
ensure => $version,
|
ensure => $version,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# The init script always creates /var/log/kibana and sets appropriate rights.
|
||||||
|
$log_dir = '/var/log/kibana'
|
||||||
|
|
||||||
file { '/opt/kibana/config/kibana.yml':
|
file { '/opt/kibana/config/kibana.yml':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
|
# This template uses $log_dir
|
||||||
content => template('lma_logging_analytics/kibana4.yaml.erb'),
|
content => template('lma_logging_analytics/kibana4.yaml.erb'),
|
||||||
notify => Service['kibana'],
|
notify => Service['kibana'],
|
||||||
require => Package['kibana'],
|
require => Package['kibana'],
|
||||||
|
@ -48,4 +52,14 @@ class lma_logging_analytics::kibana (
|
||||||
hasrestart => true,
|
hasrestart => true,
|
||||||
require => Package['kibana'],
|
require => Package['kibana'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file { '/etc/logrotate.d/kibana.conf':
|
||||||
|
ensure => present,
|
||||||
|
# This template uses $log_dir
|
||||||
|
content => template('lma_logging_analytics/kibana_logrotate.conf.erb'),
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0644',
|
||||||
|
require => Package['kibana'],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,4 +28,6 @@ describe 'lma_logging_analytics::kibana' do
|
||||||
:ensure => '42.24')
|
:ensure => '42.24')
|
||||||
}
|
}
|
||||||
it { should contain_service('kibana')}
|
it { should contain_service('kibana')}
|
||||||
|
|
||||||
|
it { is_expected.to contain_file('/etc/logrotate.d/kibana.conf') }
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,3 +2,4 @@ elasticsearch.url: "<%= @es_scheme %>://<%= @es_host %>:<%= @es_port %>"
|
||||||
server.host: <%= @listen_address %>
|
server.host: <%= @listen_address %>
|
||||||
server.port: <%= @listen_port %>
|
server.port: <%= @listen_port %>
|
||||||
kibana.defaultAppId: "dashboard/Logs"
|
kibana.defaultAppId: "dashboard/Logs"
|
||||||
|
logging.dest: "<%= @log_dir %>/kibana.log"
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
# managed by puppet
|
||||||
|
|
||||||
|
<%= @log_dir %>/*.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