question about traffic statistics on each vhost,is it po
mike503 at gmail.com
Thu Oct 2 02:39:35 MSD 2008
On Wed, Oct 1, 2008 at 1:43 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> It's not simple "dump out Host: header", it's shared memory, locking mutex
> for each request, loosing stats on binary upgrade, etc, etc.
> I see no reason why this can't be done from access_logs by simple perl
> script - either running side-by-side with nginx but perfectly restarable
> whenever you want, or periodically run at low-load periods.
> We used to run similar script for calculation of average
> $upstream_response_time for monitoring purposes and as far as I recall it
> took less than 1% cpu on not-really-fast machine with more than 10 mln log
> lines per day.
Hmm, well, I've tried to get away from having to parse logfiles... but
this is something I have to implement so I can account for my
customer's bandwidth usage properly.
I don't just want $bytes_sent don't I want both sent/received, if
someone uploads a 50 meg file, the only way to get that is to get both
sides of the request right?
I was just used to zeus having a stats daemon that would write out
hourly or some other periodic way to a file each host: header, number
of requests and number of bytes and I had a nightly job run by and
parse it - very quick since it was only a few hundred lines, not a few
Anyway, I looked into using iptables and traffic accounting but it
looks like that will generate even more work and I can't seem to get
the iptables rules to work with my LVS-NAT setup properly anyway.
Thanks for replying though :)
More information about the nginx