From 1adf2091deb1b9c72c30fbf9cede901178307276 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Fri, 18 Dec 2015 09:54:33 +0000 Subject: [PATCH] Prepare mirrorlist log files for processing The mirrorlist log files are copied every hour to be fetched by the MM backend system for further processing. Once each day, yesterday's file is moved to limit the size of the log file. This also includes a daily call to tmpwatch to delete log files older than 14 days. Signed-off-by: Adrian Reber --- .../mirrormanager/mirrorlist2/tasks/main.yml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/roles/mirrormanager/mirrorlist2/tasks/main.yml b/roles/mirrormanager/mirrorlist2/tasks/main.yml index 977afc11be..4dac59b059 100644 --- a/roles/mirrormanager/mirrorlist2/tasks/main.yml +++ b/roles/mirrormanager/mirrorlist2/tasks/main.yml @@ -92,3 +92,24 @@ copy: src=logrotate-syslog dest=/etc/logrotate.d/syslog tags: - mirrorlist2 + +# Copy the mirrorlist log file every hour to be ready to be processed +- name: mirrorlist copy cron + cron: name="copy-mirrorlist" minute="50" hour="*/2" user="mirrormanager" + job="cp /var/log/mirrormanager/mirrorlist.log /var/log/mirrormanager/mirrorlist.log.`date +\%Y-\%m-\%d`" + cron_file=copy-mirrorlist + - mirrorlist2 + +# At the start of the day the mirrorlist log file is moved +- name: mirrorlist move cron + cron: name="move-mirrorlist" minute="1" hour="0" user="mirrormanager" + job="mv /var/log/mirrormanager/mirrorlist.log /var/log/mirrormanager/mirrorlist.log.`date +\%Y-\%m-\%d --date='yesterday'`" + cron_file=move-mirrorlist + - mirrorlist2 + +# Cleanup old mirrorlist logfile +- name: mirrorlist clean cron + cron: name="clean-mirrorlist" minute="13" hour="13" user="mirrormanager" + job="/usr/sbin/tmpwatch --mtime 14d /var/log/mirrormanager" + cron_file=clean-mirrorlist + - mirrorlist2