blob: 24135e60617147d8dda4c627414094df0143d71e [file] [log] [blame]
{%- from "apache/map.jinja" import server with context %}
job:
apache2:
- files:
- /var/log/apache2/*.log
options:
- daily
- missingok
- rotate: 14
- compress
- delaycompress
- notifempty
- sharedscripts
- prerotate:
RANDOM=$(( $(dd if=/dev/urandom bs=2 count=1 2> /dev/null | cksum | cut -d' ' -f1) % 32767 ));
RANDOM_START={{ server.logrotate.start_period }};
RANDOM_END={{ server.logrotate.end_period }};
RANGE=$(( $RANDOM_END - $RANDOM_START ));
RESULT=$(( $RANDOM % $RANGE));
RESULT=$(( $RESULT + $RANDOM_START ));
sleep $RESULT
- postrotate: "if /etc/init.d/apache2 status > /dev/null; then /etc/init.d/apache2 reload > /dev/null; fi"