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'm looking for a way to be able to track the bandwidth of multiple vhosts on an nginx web server. I'm guessing there is a way that I can set up the log files to output this information and then I can write a script to parse through the log files and add up the file sizes.

If that is the case does anyone know the correct log format, and if there is already a script out there that does this?

share|improve this question

You can define new logs and their format using ngx_http_log_module. You can use the following commands in http, server or location sections:

log_format name format [format ...] defines the format of the new log. Variable $bytes_sent will add the number of bytes sent for every request, including the length of HTTP headers.

access_log path [format [buffer=size]] specifies log-files. You can run this command for every vhost to define a separate log for every vhost.

share|improve this answer
Does this work with nginx-rtmp module? – Ben Feb 13 '14 at 17:36
@Ben , I don't think so, sorry. – minaev Feb 27 '14 at 7:03

There's a munin plugin that does exactly what you want - filters by specific vhosts and graphs it.

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.