puppet-openstackci/files/log_archive_maintenance.sh
Ramy Asselin e8106a86e6 Create a log server like http://logs.openstack.org
Copy the log server templates & files used in:
https://git.openstack.org/cgit/openstack-infra/system-config/tree/modules/openstack_project

Refactor the log server portion out of:
https://git.openstack.org/cgit/openstack-infra/system-config/tree/modules/openstack_project/manifests/static.pp

Additional modifications:
1. Add protections for portions that are likely to conflict.
2. Update os_loganalyzer install to use pip instead of python

Related system-config change: I390f6ea8aaace276d211d55a0e17f25dd6ae26b5

Change-Id: Ib8476df83b7c5491158fa3cab588213be60fa2ab
2015-05-04 16:30:18 -07:00

14 lines
673 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 +120 -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 {} \; \) \)