system-config/modules/openstack_project/files/log_archive_maintenance.sh
Jeremy Stanley 7eb7e1157f Reduce log compression frequency and optimize
The I/O bandwidth starvation inflicted on static.openstack.org
during log compression and deletion runs is overwhelming the server
and preventing other activities from completing in a timely fashion.
Use optimization level 3 to hopefully improve performance of each
run, and schedule them to only run weekly around or shortly after
midnight Saturday mornings American time instead of every six hours.
Filesystems on static.openstack.org will also be increased in size
accordingly to provide more cushion for data to build up between
runs.

Change-Id: I0d9f0c4c1a254bbba2d1cbfca4603ceb34274f9d
2013-08-23 16:09:33 +00:00

21 lines
773 B
Bash

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