nginx logging with huge vhosts

Jonathan Matthews contact at
Wed Apr 30 08:25:07 UTC 2014

On 30 Apr 2014 05:56, "Joydeep Bakshi" <joydeep.bakshi at>
> Hello Maxim,
> Presently I have configured separate access & error log for each & every
nginx vhost.  I wonder if  there is other alternative which can log all
vhosts into a common access & error log and later split them according to
vhost for easy debugging.

IIRC there are a variety of projects which do this, with differing degrees
of completeness, robustness and complexity. Google should help - I don't
have any tool names offhand because it's not the early 2000s any more and
things have moved on :-) Logstash, Heka and other centralised logging
systems are your friend. None of these, however, are part of nginx.

If you need to log to a deterministic, per-vhost filename, you might like
to look at using a variable in your access_log declaration. Combined with
only specifying it once at the http{} level of your config, this can reduce
config complexity at a (slight) runtime cost.

Maxim has already provided the links to the documentation describing how to
do this.


PS I just remembered: AWStats. That's one tool that can do log splitting or
reporting - I forget which. I wouldn't use it these days though. Better
solutions exist.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list