#!/bin/bash set -u cd "/home/age/logs/sao-apache/2006" #TODO ## das ist hier etwas bloede ## die logfiles sollten gzipped sein und ein .gz am ende haben ## hier stehen sie aber ophne drin LOGFILES="access-sao2006-02.log.shrunk access-sobi2006-02.log.shrunk" DEST="/tmp/tmplog" ## hier werden ein paar dinge rausgefiltert for SRC in $LOGFILES; do cp -v ${SRC}.gz ${DEST}.gz gunzip -v ${DEST}.gz rows_orig=`wc -l $DEST | cut -d " " -f 1` ## hier kannst du deine inline sed replacements einfuegen sed -i 's/^/127.0.0.1 /' $DEST sed -i '/Python-urllib/d' $DEST #sed -i '/\"Wget\/1\.9\.1\"/d' $DEST sed -i '/check_http\/1\.81/d' $DEST sed -i '/U\;\ Nessus/d' $DEST sed -i '/action=rss/d' $DEST rows_filtered=`wc -l $DEST | cut -d " " -f 1` echo "logentries original: $rows_orig and filtered: $rows_filtered" visitors -AT -m 30 ${DEST} -o html --prefix https://systemausfall.org > ${SRC}_report_full.html echo "generated full report" visitors -WKOBXY -m 30 -i 15 -x 15 ${DEST} -o html --prefix https://systemausfall.org > ${SRC}_report_public.html echo "generated public report" visitors ${DEST} --prefix https://systemausfall.org --graphviz > ${SRC}.graph.dot neato ${SRC}.graph.dot -Tpng -o ${SRC}.graph.png rm "$DEST" "${SRC}.graph.dot" done exit 0 ## den report gengerieren #visitors --prefix https://systemausfall.org -AT -m 30 ${DEST}.0 -o html > ${SRC}_fullreport.html #visitors --prefix https://systemausfall.org -XKUWDOBT -m 30 ${SRC}.clean -o html > ${SRC}_customreport.html #echo "generated custom report" #visitors --prefix https://systemausfall.org -WKOBXY -m 30 -i 15 -x 15 ${SRC}.clean -o html > ${SRC}_publicreport.html ## noch ne kleine grafik erzeugen #echo "generating the graph" #visitors ${SRC}.clean --prefix https://systemausfall.org --graphviz > ${SRC}.graph.dot #dot ${SRC}.graph.dot -Tpng > ${SRC}.graph.png ############################################### cp ${SRCSAO}.gz ${DESTSAO}.gz gunzip $DESTSAO sed -i 's/^/127.0.0.1 /' $DESTSAO sed -i '/Python-urllib/d' $DESTSAO #sed '/\"Wget\/1\.9\.1\"/d' $DEST.a > ${DEST}.b sed -i '/check_http\/1\.81/d' $DESTSAO sed -i '/U\;\ Nessus/d' $DESTSAO sed -i '/action=rss/d' $DESTSAO cp $DESTSAO ${SRCSAO}.clean #rm ${DESTSAO}.* cp $SRCSOBI.gz $DESTSOBI.gz gunzip $DESTSOBI sed -i 's/^/127.0.0.1 /' $DESTSOBI sed '/Python-urllib/d' $DESTSOBI > ${DESTSOBI}.a #sed '/\"Wget\/1\.9\.1\"/d' $DEST.a > ${DEST}.b sed '/U\;\ Nessus/d' $DESTSOBI.a > ${DESTSOBI}.c sed '/action=rss/d' $DESTSOBI.c > ${DESTSOBI}.d cp ${DESTSOBI}.d ${SRCSOBI}.clean #rm ${DESTSOBI}.* visitors -XKUWDOBT -m 30 ${SRCSAO}.clean -o html --prefix https://systemausfall.org > ${SRCSAO}_report.html visitors ${SRCSAO}.clean --prefix https://systemausfall.org --graphviz > ${SRCSAO}.graph.dot neato ${SRCSAO}.graph.dot -Tpng -o ${SRCSAO}.graph.png visitors -XKUWDOBT -m 30 ${SRCSOBI}.clean -o html --prefix https://systemausfall.org > ${SRCSOBI}_report.html visitors ${SRCSOBI}.clean --prefix https://systemausfall.org --graphviz > ${SRCSOBI}.graph.dot neato ${SRCSOBI}.graph.dot -Tpng -o ${SRCSOBI}.graph.png for $SRC in $LOGFILES; do DEST=${SRC}.tmp cp $SRC.gz $DEST.gz gunzip $DEST sed -i 's/^/127.0.0.1 /' $DEST sed '/Python-urllib/d' $DEST> ${DEST}.a #sed '/\"Wget\/1\.9\.1\"/d' $DEST.a > ${DEST}.b sed '/U\;\ Nessus/d' $DEST.a > ${DEST}.c sed '/action=rss/d' $DEST.c > ${DEST}.d cp ${DEST}.d ${SRC}.clean visitors -XKUWDOBT -m 30 ${SRC}.clean -o html --prefix https://systemausfall.org > ${SRC}_report.html visitors ${SRC}.clean --prefix https://systemausfall.org --graphviz > ${SRC}.graph.dot neato ${SRC}.graph.dot -Tpng -o ${SRC}.graph.png done