File tree Expand file tree Collapse file tree
ansible/roles/loggly/files Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,14 +18,14 @@ datetime=`date +%Y%m%d%H%m`
1818
1919# these logfiles haven't been modified in > 24 hours, so moving them without cleanup up filehandles first should be OK:
2020echo " Compressing logs > 24h"
21- find ${logdir} -maxdepth 2 -type f -mmin +1440 -name ' *.log' -exec bzip2 -9 {} \; -print
21+ find " ${logdir} " -maxdepth 2 -type f -mmin +1440 -name ' *.log' -exec bzip2 -9 {} \; -print
2222echo " Restarting rsyslogd"
2323# but we do need to clean the filehandles after, just in case
2424service rsyslog restart
2525
2626# archive anything > 6h
2727echo " Archiving logs > 6h"
28- mkdir -p ${archdir} 2>&1
29- find ${logdir} -maxdepth 2 -type f -mtime +6 -name ' *z' | xargs tar jcvpf ${archdir} /log-archive-${datetime} .tbz
28+ mkdir -p " ${archdir} " 2>&1
29+ find " ${logdir} " -maxdepth 2 -type f -mtime +6 -name ' *z' | xargs tar jcvpf " ${archdir} " /log-archive-" ${datetime} " .tbz
3030echo " Purging logs > 1wk"
31- find ${logdir} -maxdepth 2 -type f -mtime +6 -exec rm -f {} \; -print
31+ find " ${logdir} " -maxdepth 2 -type f -mtime +6 -exec rm -f {} \; -print
Original file line number Diff line number Diff line change 55# Runs from crontab.
66#
77
8- logdir=${1}
8+ logdir=" ${1} "
99
1010# We can compress anything older than 6 hours
11- find ${logdir} -mindepth 2 -type f -mmin +360 -name ' *.log' -exec bzip2 -9 {} \;
11+ find " ${logdir} " -mindepth 2 -type f -mmin +360 -name ' *.log' -exec bzip2 -9 {} \;
1212
1313# We automatically purge anything > 1wk
14- find ${logdir} -maxdepth 2 -type f -mtime +7 -exec rm -f {} \;
14+ find " ${logdir} " -maxdepth 2 -type f -mtime +7 -exec rm -f {} \;
You can’t perform that action at this time.
0 commit comments