diff --git a/cookbooks/prometheus/alertmanager_setup.rb b/cookbooks/prometheus/alertmanager_setup.rb index 9955c3e..31c0774 100644 --- a/cookbooks/prometheus/alertmanager_setup.rb +++ b/cookbooks/prometheus/alertmanager_setup.rb @@ -54,6 +54,13 @@ service 'rsyslog' do action :nothing end +# Deploy `logroted` config for `alertmanager`: +remote_file '/etc/logrotate.d/alertmanager' do + owner 'root' + group 'root' + mode '644' +end + # Firewall settings here: %w( 9093/tcp ).each do |p| execute "ufw allow #{p}" do diff --git a/cookbooks/prometheus/files/etc/logrotate.d/alertmanager b/cookbooks/prometheus/files/etc/logrotate.d/alertmanager new file mode 100644 index 0000000..31c9dcf --- /dev/null +++ b/cookbooks/prometheus/files/etc/logrotate.d/alertmanager @@ -0,0 +1,13 @@ +/var/log/alertmanager.log +{ + rotate 4 + weekly + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + /usr/lib/rsyslog/rsyslog-rotate + endscript +} diff --git a/cookbooks/prometheus/files/etc/rsyslog.d/30-alertmanager.conf b/cookbooks/prometheus/files/etc/rsyslog.d/30-alertmanager.conf new file mode 100644 index 0000000..097c66b --- /dev/null +++ b/cookbooks/prometheus/files/etc/rsyslog.d/30-alertmanager.conf @@ -0,0 +1,7 @@ +# Log kernel generated digdag log messages to file +:syslogtag,contains,"alertmanager" /var/log/alertmanager.log + +# Uncomment the following to stop logging anything that matches the last rule. +# Doing this will stop logging kernel generated UFW log messages to the file +# normally containing kern.* messages (eg, /var/log/kern.log) +& stop