Compress fedora_stats *.log files automatically with xz.

Signed-off-by: James Antill <james@and.org>
This commit is contained in:
James Antill 2024-07-12 13:59:15 -04:00 committed by kevin
parent 9b00cb29e7
commit 602723ed45
2 changed files with 10 additions and 1 deletions

View file

@ -1 +1,10 @@
# Compress host log files daily.
0 06 * * * root /usr/bin/find /var/log/hosts -type f -name "*.log" -print | grep -v "$(date +'/\%Y/\%m/\%d/')" | xargs -r -n1 xz -1 > /dev/null
# Compress this days log files from last month in fedora_stats.
# NOTE: We stop on the 28th, the rest will be caught in the monthly.
0 07 1-28 * * root /usr/bin/find "/mnt/fedora_stats/combined-http/$(date --date='1 Month ago' +%Y/%m/%d)" -type f -name "*.log" -print | xargs -r -n 1 -P 2 nice xz -1 > /dev/null
# Compress entire month from _two_ months ago log files in fedora_stats.
# NOTE: We don't do it on the 1st for an abundance of caution.
0 08 8 * * root /usr/bin/find "/mnt/fedora_stats/combined-http/$(date --date='2 Month ago' +%Y/%m)" -type f -name "*.log" -print | xargs -r -n 1 -P 2 nice xz -1 > /dev/null

View file

@ -533,7 +533,7 @@
- config
- python3alternative
- name: daily cron job to compress merged log under /var/log/hosts
- name: cron jobs to compress logs under /var/log/hosts and /mnt/fedora_stats
copy: src=compress-log.cron dest=/etc/cron.d/ mode=0644
tags:
- compress