Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

When you have a server that hosts websites for other people, curious how you track transfer usage per account?


share|improve this question

Use a tool to generate statistical information from your webserver logs.

A good one is AWStats. It can mesure bandwidth usage on a per-website basis.

share|improve this answer

Aside from using a package like AWstats, if you're trying to get at the information yourself your only hope is, as nrgyz said, the webserver logs (in particular what are called the "access logs"). You can grok from those logs who's accessing which files, then filter out the user in particular based on directory or some other mechanism, as well as the date-range you're interested in, and create a hash/map structure or something that counts how many time each file was hit and then do the math based on file-size.

AWstats works quite well, I use it for a number of customers. There's also Mint and Webalizer (and probably a billion more in freshmeat)

share|improve this answer

If you have the luxury of configuring all services for a particular account under it's own IP address then you can use ip accounting in iptables. Setup different chains for each IP and then use a script running from cron to store the results into a rrd (like cacti) or SQL database.

The benefit of this approach is you get all traffic for that customer, including web, scp, email, ftp, DDOS attacks, etc.

share|improve this answer
Here's a perl script for dumping web bandwidth summaries into cacti: – Weston Dec 10 '09 at 20:21

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.