2004-08-21 01:10

by Vasil Kolev

It was a lot of walking, but in the end I got the documents for a personal doctor, at Monday I’mm bring them where I should (If haven’t died by then). Looks like I’m getting better, I wrote a small shell script today, something like a rudimentary apache log analyzer, with a specific task – to say how much traffic did some directories generate. There are a few problems that need fixing (to clean up the referrers, before the main grep), but I’ll do that after understanding something in regex…. Here’s the script:

#!/bin/sh
(
for i in Anime/* upload/*/* Manga/* AMV/*  ;  do 
        nm=`echo $i|sed 's/ /%20/g; s/\[/%5b/g;s/\]/%5d/g'` ;
        mb=`( \
	echo -n '(';grep -iw "$nm" /var/log/apache/chise.ludost.net.log /var/log/apache/chise.ludost.net.log.1 |\ 
	grep GET |sed 's/"GET .* HTTP\/1.[01]" /asd/g'|grep -v asd304 |awk '{print $7}' |tr '\n' '+'| \ 
	sed 's/\+$//g'; echo ')/(1024*1024)' \
	) |bc 2>/dev/null`

        if [ -z "$mb" ]; then mb=0; fi
        echo -e "$mb\t$i" 
done
)| sort -rn

The result can be seen here.

I still haven’t halved Quicksilver, Bobson, could you bring me the book on the next IBB (I promise I’ll return it), because it’s not easy to read on these pages (I’ve reached around page 300)?

Leave a Reply