--- /dev/null
+# see "man logrotate" for details
+# rotate log files weekly
+weekly
+
+# keep 4 weeks worth of backlogs
+rotate 99
+
+# create new (empty) log files after rotating old ones
+create
+
+# uncomment this if you want your log files compressed
+compress
+delaycompress
+
+# packages drop log rotation information into this directory
+include /etc/logrotate.d
+
+# no packages own wtmp, or btmp -- we'll rotate them here
+/var/log/wtmp {
+ missingok
+ monthly
+ create 0664 root utmp
+ rotate 12
+ size 4M
+}
+
+/var/log/btmp {
+ missingok
+ monthly
+ create 0660 root utmp
+ rotate 12
+ size 4M
+}
+
+# system-specific logs may be configured here
--- /dev/null
+#!/bin/bash
+
+{% set logrotate_verbose = salt['pillar.get']('logrotate:verbose', False) -%}
+{%- set verbose_option = '' -%}
+{%- if logrotate_verbose -%}
+ {%- set verbose_option = '-v' -%}
+{%- endif -%}
+test -x /usr/sbin/logrotate || exit 0
+LOG=/var/log/logrotate.log
+echo >> ${LOG}
+echo "################################################" >> ${LOG}
+echo "[$(date --rfc-3339=seconds )]: Start Logrotating" >> ${LOG}
+/usr/sbin/logrotate {{ verbose_option }} /etc/logrotate.conf 2>&1 >>${LOG}
+echo "[$(date --rfc-3339=seconds )]: End Logrotating" >> ${LOG}
--- /dev/null
+
+logrotate:
+ pkg:
+ - installed
+
+/etc/logrotate.d:
+ file.directory:
+ - user: root
+ - group: root
+ - dir_mode: 755
+
+/etc/logrotate.conf:
+ file.managed:
+ - user: root
+ - group: root
+ - mode: 644
+ - source: salt://basic/files/logrotate.conf
+ - backup: minion
+ - require:
+ - pkg: logrotate
+ - file: /etc/logrotate.d
+
+/etc/cron.daily/logrotate:
+ file.managed:
+ - user: root
+ - group: root
+ - mode: 755
+ - source: salt://basic/files/logrotate.cron
+ - template: jinja
+ - backup: minion
+ - onlyif:
+ - test -d /etc/cron.daily
+ - require:
+ - pkg: logrotate
+ - file: /etc/logrotate.conf
+
- basic.editors
- basic.localization
- debian.sysvinit
+ - basic.logrotate
- basic.pkgs
- basic.rsyslog
- basic.shells