Forum Moderators: phranque

Message Too Old, No Replies

How to Monitor Web Traffic On Apache Servers

         

debajit kataki

9:48 am on Jun 2, 2009 (gmt 0)

10+ Year Member



Hi,

I want to know how much traffic was served by my apache web server on any particular day.

what is the best way to do/implement so.

mod_status/server-status shows but its a total from the time of last server start till now.

any pointer please?
~DK

tangor

10:33 am on Jun 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I parse the server logs. Quick and neat, and pretty accurate!

debajit kataki

10:40 am on Jun 2, 2009 (gmt 0)

10+ Year Member




Ya that's true, but i have some 15+ Vhosts, so was looking for some alternate way so that i know how much traffic was served by each server today(or any particular day)

~DK

debajit kataki

6:48 am on Jun 3, 2009 (gmt 0)

10+ Year Member



One good thing is that i rotate all the logs, hence could capture all the access logs in a file

ls -lrt /usr/local/apache2/logs/ ¦ grep access ¦ awk '{ print $9}' > /tmp/url.txt

and then,

for i in `cat /tmp/url.txt` ; do cat $i ¦ awk '{ sum = sum + $10 } END {print sum }'; done ¦ awk '{ sum = sum + $1 } END { print sum/1073741824 ,"GB"}';

1.78338 GB

This is what I could do the raw way, but ya, if the log files are very huge for a high traffic facing server, it will spike up the load i think.

..hence still looking for some stable solution out.

~DK