diff --git a/cookbooks/prometheus-exporters/files/etc/logrotate.d/node_exporter b/cookbooks/prometheus-exporters/files/etc/logrotate.d/node_exporter new file mode 100644 index 0000000..78838a9 --- /dev/null +++ b/cookbooks/prometheus-exporters/files/etc/logrotate.d/node_exporter @@ -0,0 +1,13 @@ +/var/log/node_exporter.log +{ + rotate 4 + weekly + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + /usr/lib/rsyslog/rsyslog-rotate + endscript +} diff --git a/cookbooks/prometheus-exporters/node_exporter_setup.rb b/cookbooks/prometheus-exporters/node_exporter_setup.rb index 9b6fd64..3f4d4f0 100644 --- a/cookbooks/prometheus-exporters/node_exporter_setup.rb +++ b/cookbooks/prometheus-exporters/node_exporter_setup.rb @@ -28,6 +28,13 @@ service 'rsyslog' do action :nothing end +# Deploy `logrotate` config for `node_exporter`: +remote_file '/etc/logrotate.d/node_exporter' do + owner 'root' + group 'root' + mode '0644' +end + # Deploy `consul` config for `node_exporter`: remote_file '/etc/consul.d/service-node_exporter.json' do owner 'consul'