2016-03-02 21:23:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-03-07 17:42:11 +00:00
|
|
|
# This file is part of Fedora Project Infrastructure Ansible
|
|
|
|
# Repository.
|
2016-03-02 21:23:30 +00:00
|
|
|
#
|
2016-03-07 17:42:11 +00:00
|
|
|
# Fedora Project Infrastructure Ansible Repository is free software:
|
|
|
|
# you can redistribute it and/or modify it under the terms of the GNU
|
|
|
|
# General Public License as published by the Free Software Foundation,
|
|
|
|
# either version 3 of the License, or (at your option) any later
|
|
|
|
# version.
|
2016-03-02 21:23:30 +00:00
|
|
|
#
|
2016-03-07 17:42:11 +00:00
|
|
|
# Fedora Project Infrastructure Ansible Repository is distributed in
|
|
|
|
# the hope that it will be useful, but WITHOUT ANY WARRANTY; without
|
|
|
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
|
# PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
# details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Fedora Project Infrastructure Ansible Repository. If
|
|
|
|
# not, see <http://www.gnu.org/licenses/>.
|
2016-03-02 21:23:30 +00:00
|
|
|
|
|
|
|
# Because sync-http may not get all logs for 3 days, we only merge
|
|
|
|
# things after 4 days.
|
2016-03-07 17:42:11 +00:00
|
|
|
|
2019-10-01 19:35:01 +00:00
|
|
|
# 2019-10-01 Dropped this down to 3 days..
|
|
|
|
|
2019-10-02 17:28:10 +00:00
|
|
|
NUMDAYS=2
|
2016-03-02 21:23:30 +00:00
|
|
|
YEAR=$(/bin/date -d "-${NUMDAYS} days" +%Y)
|
|
|
|
MONTH=$(/bin/date -d "-${NUMDAYS} days" +%m)
|
|
|
|
DAY=$(/bin/date -d "-${NUMDAYS} days" +%d)
|
|
|
|
|
|
|
|
LOGDIR=/var/log/hosts
|
2016-05-04 15:59:10 +00:00
|
|
|
NFSDIR=/mnt/fedora_stats/combined-http
|
2016-06-02 17:18:45 +00:00
|
|
|
PROXYLOG=${LOGDIR}/proxy*/${YEAR}/${MONTH}/${DAY}/http/
|
2020-06-10 08:06:38 -04:00
|
|
|
DL_LOG=${LOGDIR}/dl*/${YEAR}/${MONTH}/${DAY}/http/
|
2017-11-27 20:20:20 +00:00
|
|
|
PEOPLE=${LOGDIR}/people*/${YEAR}/${MONTH}/${DAY}/http/
|
2016-03-02 21:23:30 +00:00
|
|
|
|
2016-05-04 15:59:10 +00:00
|
|
|
TARGET=${NFSDIR}/${YEAR}/${MONTH}/${DAY}
|
|
|
|
|
|
|
|
LOGMERGE=/usr/share/awstats/tools/logresolvemerge.pl
|
2016-03-02 21:23:30 +00:00
|
|
|
|
2016-06-02 17:18:45 +00:00
|
|
|
mkdir -p ${TARGET}
|
|
|
|
|
2017-11-27 20:20:20 +00:00
|
|
|
##
|
|
|
|
## Merge the Proxies
|
|
|
|
FILES=$( ls -1 ${PROXYLOG}/*access.log.xz | awk '{x=split($0,a,"/"); print a[x]}' | sort -u )
|
|
|
|
|
2016-06-02 17:18:45 +00:00
|
|
|
for FILE in ${FILES}; do
|
|
|
|
TEMP=$(echo ${FILE} | sed 's/\.xz$//')
|
|
|
|
perl ${LOGMERGE} ${PROXYLOG}/${FILE} > ${TARGET}/${TEMP}
|
|
|
|
done
|
|
|
|
|
2017-11-27 20:20:20 +00:00
|
|
|
##
|
|
|
|
## Merge the Downloads
|
2016-06-02 17:18:45 +00:00
|
|
|
FILES=$( ls -1 ${DL_LOG}/dl*access.log.xz | awk '{x=split($0,a,"/"); print a[x]}' | sort -u )
|
2016-03-02 21:23:30 +00:00
|
|
|
|
|
|
|
for FILE in ${FILES}; do
|
|
|
|
TEMP=$(echo ${FILE} | sed 's/\.xz$//')
|
2016-06-02 17:18:45 +00:00
|
|
|
perl ${LOGMERGE} ${DL_LOG}/${FILE} > ${TARGET}/${TEMP}
|
2016-03-02 21:23:30 +00:00
|
|
|
done
|
2016-05-04 15:59:10 +00:00
|
|
|
|
2017-11-27 20:20:20 +00:00
|
|
|
##
|
|
|
|
## Merge the People
|
|
|
|
##
|
|
|
|
## Merge the Downloads
|
|
|
|
FILES=$( ls -1 ${PEOPLE}/fedora*access.log.xz | awk '{x=split($0,a,"/"); print a[x]}' | sort -u )
|
|
|
|
|
|
|
|
for FILE in ${FILES}; do
|
|
|
|
TEMP=$(echo ${FILE} | sed 's/\.xz$//')
|
|
|
|
perl ${LOGMERGE} ${PEOPLE}/${FILE} > ${TARGET}/${TEMP}
|
|
|
|
done
|
|
|
|
|
2016-05-04 15:59:10 +00:00
|
|
|
# Now we link up the files into latest directory
|
|
|
|
# 1. make sure the latest directory exists
|
|
|
|
# 2. go into it.
|
|
|
|
# 3. remove the old links
|
|
|
|
# 4. link up all the files we merged over
|
|
|
|
|
|
|
|
if [[ -d ${NFSDIR}/latest ]]; then
|
|
|
|
pushd ${NFSDIR}/latest &> /dev/null
|
|
|
|
/bin/rm -f *
|
|
|
|
for file in ../${YEAR}/${MONTH}/${DAY}/*; do
|
|
|
|
ln -s ${file} .
|
|
|
|
done
|
|
|
|
popd &> /dev/null
|
|
|
|
fi
|