<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<body bgcolor="#ffffff" text="#000000">
<pre wrap="">On Wed, Oct 1, 2008 at 1:43 PM, Maxim Dounin <a class="moz-txt-link-rfc2396E" href="mailto:firstname.lastname@example.org"><email@example.com></a> wrote:
<pre wrap="">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.
Previously there was a syslog patch sent to the list (which I hope
might one day get committed... here's hoping...).<br>
With a bit of ingenuity you can syslog to some other machine which
simply eats the syslog and computes some stats.<br>
Alternatively it's not rocket science to write a little perl demon
which just tails your log file and generates stats. It might even work
to have nginx write to some kind of named pipe and have your perl demon
consume the log file without spooling to disk at all (what happens if
something falls over though... Writing to disk gives you some soft
coupling of systems)<br>