Tomcat – How to monitor bandwidth usage in Tomcat

bandwidthloggingtomcat

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.

Best Answer

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.

Related Topic