3

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?

bwizzy
  • 1,295
  • 4
  • 14
  • 17

2 Answers2

1

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.

minaev
  • 1,617
  • 1
  • 13
  • 13
1

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

David Miller
  • 111
  • 3