start off with an awstats for log01

This commit is contained in:
Stephen Smoogen 2016-03-02 21:23:30 +00:00
parent ef9fc80b37
commit 993b750c82
4 changed files with 53 additions and 1 deletions

View file

@ -0,0 +1 @@
0 06 * * * root /usr/local/bin/combineHttpLogs.sh

View file

@ -0,0 +1,28 @@
#!/bin/bash
#
# The object of this script is to combine multiple http logs from the
# proxy servers and put them into an NFS directory where they can be
# analyzed by other software on other systems.
#
# Because sync-http may not get all logs for 3 days, we only merge
# things after 4 days.
NUMDAYS=4
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
HTTPLOG=${LOGDIR}/proxy*/${YEAR}/${MONTH}/${DAY}/http/
TARGET=/mnt/fedora_stats/combined-http/${YEAR}/${MONTH}/${DAY}
AWSTATS=/usr/share/awstats/tools/logresolvemerge.pl
FILES=$( ls -1 ${HTTPLOG}/*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 ${AWSTATS} ${HTTPLOG}/${FILE} > ${TARGET}/${TEMP}
done

View file

@ -0,0 +1,23 @@
---
- name: install awstats package
yum: state=present name=epylog
tags:
- packages
- awstats
- name: awstats proxy merge script (log01)
copy: src=combineHttpLogs.sh dest=/usr/local/bin/ mode=0755
when: inventory_hostname.startswith('log01')
tags:
- config
- awstats
- name: awstats daily cron job to merge old logs
copy: src=combineHttp.cron dest=/etc/cron.d/ mode=0644
when: inventory_hostname.startswith('log01')
tags:
- cron
- awstats
#- name: set up http configs for awstats on dataserver

View file

@ -408,7 +408,7 @@
#
# Watchdog stuff
#
- name: See if there's a watchdog device
- name: See if theres a watchdog device
stat: path=/dev/watchdog
when: ansible_virtualization_role == 'guest'
register: watchdog_dev