From ec680b2719921d59d76d64f342842e50ece8241c Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 11 Feb 2023 21:38:50 +0900 Subject: [PATCH] Deploy `/etc/logrotate.d/prometheus`. --- .../prometheus/files/etc/logrotate.d/prometheus | 13 +++++++++++++ cookbooks/prometheus/prometheus_setup.rb | 7 +++++++ 2 files changed, 20 insertions(+) create mode 100644 cookbooks/prometheus/files/etc/logrotate.d/prometheus diff --git a/cookbooks/prometheus/files/etc/logrotate.d/prometheus b/cookbooks/prometheus/files/etc/logrotate.d/prometheus new file mode 100644 index 0000000..d9fd673 --- /dev/null +++ b/cookbooks/prometheus/files/etc/logrotate.d/prometheus @@ -0,0 +1,13 @@ +/var/log/prometheus.log +{ + rotate 4 + weekly + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + /usr/lib/rsyslog/rsyslog-rotate + endscript +} diff --git a/cookbooks/prometheus/prometheus_setup.rb b/cookbooks/prometheus/prometheus_setup.rb index bda685c..ab8a564 100644 --- a/cookbooks/prometheus/prometheus_setup.rb +++ b/cookbooks/prometheus/prometheus_setup.rb @@ -44,6 +44,13 @@ service 'rsyslog' do action :nothing end +# Depoy `logrotate` configuration for `prometheus`: +remote_file '/etc/logrotate.d/prometheus' do + owner 'root' + group 'root' + mode '644' +end + # Depoy `consul` service configuration for `prometheus`: remote_file '/etc/consul.d/service-prometheus.json' do owner 'consul'