Forum

/ Home \ \ Subjects /



Subject: Log filter/totals calculator

15/04/2009 15:21 AnrDaemon:
www.rootdir.org/.offload/logparse.src

this is PHP script that get the file given by the first argument and prints out filtered log (requests to proxy, with header string) to stdout and (sub)totals for the given log to stderr.

Calling it like

logparse.php main0403 > main0403.log

Will result in statistics displayed similar to the

192.168.17.6: in: 91 872 / out: 1 924
Summary: in: 91 872 / out: 1 924

And the main0403.log file created with lines like

!->19/01 09:30:16 [192.168.17.6:1040>3128] (t1 39) GET www.mail.ru/ HTTP/1.0
!->19/01 09:30:21 [192.168.17.6:1040>3128] (t1 43) >Proxy in:91647 out:910
!->19/01 09:30:22 [192.168.17.6:1041>3128] (t2 44) GET img.imgsmail.ru/mail/ru/css/sear .. HTTP/1.0
!->19/01 09:30:22 [192.168.17.6:1042>3128] (t2 45) GET js.imgsmail.ru/r/js/search_top.j .. HTTP/1.0
!->19/01 09:30:24 [192.168.17.6:1043>3128] (t3 52) GET top3.mail.ru/counter?id=110605;j .. HTTP/1.0
!->19/01 09:30:24 [192.168.17.6:1044>3128] (t3 57) GET counter.rambler.ru/top100.cnt?26 .. HTTP/1.0
!->19/01 09:30:24 [192.168.17.6:1043>3128] (t4 56) >Proxy in:225 out:1014

You can easily expand it's functionality in many ways, but for me it's doing enough.

User: Password: New user:   Save password: