puppet-openstackci/files/log_archive_maintenance.sh
Jeremy Stanley a4487c5a50 Reduce job log retention to 60 days
In recent months, log volume has picked up considerably. Since we
can't increase the size of this volume any further, reduce retention
from 120 days to 60 days for now (manual expiration efforts indicate
90 days is roughly 100% of the filesystem size, so we need to go
lower).

Change-Id: Iedaf77303b00a0e2960cca22776969dca38ccd43
2016-09-29 15:53:41 +00:00

14 lines
672 B
Bash

#!/bin/sh
sleep $((RANDOM%600)) && \
flock -n /var/run/gziplogs.lock \
find -O3 /srv/static/logs/ -depth -not -name robots.txt -not -name lost+found \
-not -wholename /srv/static/logs/help/\* \( \
\( -type f -mmin +10 -not -name \*\[.-\]gz -not -name \*\[._-\]\[zZ\] \
\( -name \*.txt -or -name \*.html -or -name tmp\* \) \
-exec gzip \{\} \; \) \
-o \( -type f -mtime +60 -execdir rm \{\} \; \) \
-o \( -type d -empty -mtime +1 -execdir rmdir {} \; \) \)
find -O3 /srv/static/docs-draft/ -depth -not -name lost+found \( \
\( -type f -mtime +21 -execdir rm \{\} \; \) \
-o \( -type d -empty -mtime +1 -execdir rmdir {} \; \) \)