Monday, April 19, 2010

Total Traffic on my Apache WS


How much traffic was served by my Apache web server today?

Once i had a situation where we had to quickly figure out how much traffic was served by our web cluster. We had a Bandwidth issue in one of of our shared hosted Tier1/2 DC. I know mod_status/server-status will show me the figures, BUT, it will show a total figure from the time of last server start till now.

But i wanted today's figure.

I could not find any other quickest way hence..ran the following.

#cd /usr/local/apache2/logs

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

#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"}'

---------

$10 = apache logs “Bytes transferred”

1024*1024*1024 = 1073741824

DO get back, if you do it some other way!

Cheers!!

No comments:

Post a Comment

RCA - Root Cause Analysis

An important step in finding the root causes of issues or occurrences that happen within a system or organization is root cause analysis (RC...