commit 7bf91e4270eaa9c2ab3022154f42e2ee529668dc
Author: Nicolas Chauvet <kwizart(a)gmail.com>
Date: Wed Jul 31 10:57:41 2019 +0200
Add syncHttpdLogs template
roles/base/templates/syncHttpLogs.sh.j2 | 222 +++++++++++++++++++++++++++++++
1 files changed, 222 insertions(+), 0 deletions(-)
---
diff --git a/roles/base/templates/syncHttpLogs.sh.j2
b/roles/base/templates/syncHttpLogs.sh.j2
new file mode 100644
index 0000000..2431826
--- /dev/null
+++ b/roles/base/templates/syncHttpLogs.sh.j2
@@ -0,0 +1,222 @@
+#!/bin/bash
+
+RSYNC_FLAGS='-az --no-motd'
+
+function syncHttpLogs {
+
+ # in case we missed a run or two.. try to catch up the last 3 days.
+ for d in 1 2 3
+ do
+ HOST=$1
+ # some machines store stuff in old format. some new.
+ if [ "$2" = "old" ]; then
+ YESTERDAY=$(/bin/date -d "-$d days" +%Y-%m-%d)
+ else
+ YESTERDAY=$(/bin/date -d "-$d days" +%Y%m%d)
+ fi
+ YEAR=$(/bin/date -d "-$d days" +%Y)
+ MONTH=$(/bin/date -d "-$d days" +%m)
+ DAY=$(/bin/date -d "-$d days" +%d)
+ /bin/mkdir -p /var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/http
+ cd /var/log/hosts/$HOST/$YEAR/$MONTH/$DAY/http/
+
+ for f in $(/usr/bin/rsync $RSYNC_FLAGS --list-only $HOST::log/httpd/*$YESTERDAY*
| awk '{ print $5 }')
+ do
+ DEST=$(echo $f | /bin/sed s/-$YESTERDAY//)
+ /usr/bin/rsync $RSYNC_FLAGS $HOST::log/httpd/$f ./$DEST
+ done
+ done
+}
+
+## Sync up all proxies
+{% for host in groups['proxies'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up all internal proxies
+{% for host in groups['proxies_internal'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up all staging proxies
+{% for host in groups['proxies_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up all fas servers
+{% for host in groups['fas'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['fas_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up all fedocal hosts
+{% for host in groups['fedocal'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['fedocal_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up all data grepper hosts
+{% for host in groups['datagrepper'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['datagrepper_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up all ipsilon hosts
+{% for host in groups['ipsilon'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['ipsilon_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up all ask hosts
+{% for host in groups['ask'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['ask_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up all badges hosts
+{% for host in groups['badges_web'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['badges_web_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up all elections hosts
+{% for host in groups['elections'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['elections_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up all bodhi hosts
+{% for host in groups['bodhi2'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['bodhi2_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up packages hosts
+{% for host in groups['packages'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['packages_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up blockerbugs
+{% for host in groups['blockerbugs'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['blockerbugs_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up value
+{% for host in groups['value'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['value_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up secondary
+{% for host in groups['secondary'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up hosted
+{% for host in groups['hosted'] %}
+syncHttpLogs {{host}} old
+{% endfor %}
+
+## sync up people
+{% for host in groups['people'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## sync up nagios
+{% for host in groups['nagios'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## sync up download
+{% for host in groups['download_phx2'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['download_ibiblio'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['download_rdu2'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## sync up sundries
+{% for host in groups['sundries'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['sundries_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## sync up autocloud
+{% for host in groups['autocloud_web'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['autocloud_web_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## sync up koschei
+{% for host in groups['koschei_web'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['koschei_web_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## sync up notifs
+{% for host in groups['notifs_web'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['notifs_web_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+## Sync up pdc
+{% for host in groups['pdc_web'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
+{% for host in groups['pdc_web_stg'] %}
+syncHttpLogs {{host}}
+{% endfor %}
+
Show replies by date