diff --git a/resources/recipes/prepare_system.rb b/resources/recipes/prepare_system.rb index 5850181..7fc9253 100644 --- a/resources/recipes/prepare_system.rb +++ b/resources/recipes/prepare_system.rb @@ -34,6 +34,14 @@ ) end +template '/etc/logrotate.d/logstash' do + source 'logstash_log-rotate.erb' + owner 'root' + group 'root' + mode 0644 + retries 2 +end + service 'chef-client' do if node['redborder']['services']['chef-client'] action [:enable, :start] diff --git a/resources/templates/default/logstash_log-rotate.erb b/resources/templates/default/logstash_log-rotate.erb new file mode 100644 index 0000000..02e6903 --- /dev/null +++ b/resources/templates/default/logstash_log-rotate.erb @@ -0,0 +1,16 @@ +############################################################################### +# Generated by Chef # +############################################################################### + +/var/log/logstash/*.log { + size=20M + missingok + rotate 5 + compress + delaycompress + notifempty + copytruncate + postrotate + rm -f /var/log/logstash/*.gz > /dev/null + endscript +}