From ccf94f0174d37dd37a43d35b9d32ef57f29067fe Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 5 Feb 2023 19:43:23 +0900 Subject: [PATCH] Deploy `logrotate` config for `node_exporter`. --- .../files/etc/logrotate.d/node_exporter | 13 +++++++++++++ .../prometheus-exporters/node_exporter_setup.rb | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 cookbooks/prometheus-exporters/files/etc/logrotate.d/node_exporter 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'