How does one monitor total outgoing bandwidth usage on a per-user basis?
(I'm using apache 2.2 in case you need this information.)
All web hosts do this. So it would seem obvious, but I can't find any information on how to do this. Even a partial answer would help.
Remember, I don't care about the user's rate of usage, only their total bandwidth usage.
Thanks, Kevin
Best Answer
You need to parse the logs with a custom script. You'll also likely want a custom log format (to capture the VirtualHost names.) You can either parse the logs daily (or hourly/weekly) or you can run the logs through a script as it happens.
It's up to you to write /usr/local/bin/apachebwmeter. Make sure to coalesce the domain names (www.example.com and example.com are the same user, you might have other variations depending on your environment.) Keep in mind that %B does NOT include HTTP headers, so it'll be approximate.
-Dave