Multiple log files for one instance

Justin Pasher justinp at
Wed Sep 15 00:53:04 CEST 2010

I'm thinking what I want to do is not possible, but I figured I'd give 
it a shot.

I want to setup a generic Varnish instance that will be used to handle 
multiple web sites. All of the web sites are directed to the same 
backend and the correct site is served up by Apache using Virtual Hosts 
that match the corresponding Host: header. The idea is that a new site 
can have caching "turned on" simply by changing its IP address from the 
live server to the Varnish server. However, by doing so, all requests 
come into the same instance. This means that I cannot create separate 
log files for each site using varnishncsa.

I've played around with some ideas in regards to matching server headers 
in the log, but I'm thinking this is not even possible because I would 
have to run a varnishncsa instance for each site but have them all 
talking to the same Varnish instance. ISTM that by doing so, varnish 
would "serve" the log to only one of the daemons and not all of them, 
making the logging ineffective. I could potentially still have my log 
analyzer work by read entirely from one file, but that would require 
tweaking the output format of varnishncsa which is not possible (without 
hacking the code).

Can anyone think of a way to do something like this? Thanks.

Justin Pasher

More information about the varnish-misc mailing list