Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running an Apache Tomcat 6 website and would like a way to somehow log the amount of bandwidth used for each virtual host on the site. Is there such a plugin or logging class that I could use to achieve this? Or how much one go about writing one?

As a workaround, if I could figure out how to log individual requests along with the amount of bytes transferred (not the size the file, but the number of actual bytes sent on the wire), I guess I could write a script to add them up. I'd prefer some other type of module though, since I'm not so concerned about tracking individual pagehits.

share|improve this question
up vote 2 down vote accepted

You can configure Tomcat to do standard logging (in the "common log format") for each of the virtual hosts. Then you have a plethora of software for analyzing the logs, that's the main reason for having the common log format. Free tools like webalizer can do pretty graphs and breakdowns for you, but that's just the tip of the iceberg of tools available to do useful things with the common log format.

share|improve this answer

We had a similar requirement, but did not want to store and analyze GB's of transfer logs.

The result was an Valve implementation, that will aggregate data by virtual host and publish as mbeans + output to tomcats standard log:

Let me know (through github) if you'd like a compiled version to test

br B

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.