Files
fedora-infra_ansible/roles/base/templates/syncHttpLogs.sh.j2
Kevin Fenzi 4b31ac5152 ansible: Change all our group names from foo-bar to foo_bar or foo-bar-baz to foo_bar_baz
In ansible 2.8 the - character isn't supposed to be valid in group names.
While we could override this, might has well just bite the bullet and change it.
So, just switch all group names to use _ instead of -

Signed-off-by: Kevin Fenzi <kevin@scrye.com>
2019-05-20 17:38:09 +00:00

223 lines
4.6 KiB
Django/Jinja

#!/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 %}