varnishncsa logs split per domain

Admin Beckspaced admin at
Sun Nov 13 11:18:54 CET 2016

Same Hello here ;)

did have a more in depth look in the manual and figured out that 
varnishncsa does support VSL query.
so someone could filter on the Request Header and Host

varnishncsa -q "ReqHeader ~ '^Host: .*'"

which would produce a log for a specific domain only

it then would need multiple varnishncsa instances for logging per 
domain, which I found here:

I use varnish version 5 and then there would be no need for splitlog and 
the logs would be created directly.

please correct me if I'm wrong?

thanks for your time & help

Am 12.11.2016 um 17:05 schrieb Andrei:
> Hello again,
> My apologies for not explaining my thoughts better earlier then. Afaik,
> varnishncsa does not have a native method to split output based on
> different parameters. The method I was thinking of was based on piping
> varnishncsa output through splitlogs (or similar) for the log processing
> and writeouts. Since replying earlier, I've got this working on a cPanel
> server with piped logging enabled for Apache using the following two for
> example (X-Port is a custom header set in vcl_recv related to SSL
> offloading, but you can use a static value or similar custom header):
> varnishncsa -F "%{HOST}i:%{X-Port}i %h %l %u %t \"%m %U%q %H\" %s %b
> \"%{Referer}i\" \"%{User-agent}i\""|sed -e
> 's#^www\.##g'|/usr/local/cpanel/bin/splitlogs --main=`hostname`
> --mainout=/usr/local/apache/logs/access_log
> varnishncsa -F "%{HOST}i %{%s}t %b ."|sed -e
> 's#^www\.##g'|/usr/local/cpanel/bin/splitlogs --main=`hostname`
> --suffix=-bytes_log
> The above pipes the requests to the splitlogs binary which queues then
> writes to separate logs per domain, that are later processed by the
> cPanel log stats apps. Either way, I believe you need an intermediary
> script to queue and write the log entries per domain. While looking into
> this process, I ran across this little tidbit which you may find of use
> for logstash style output.

More information about the varnish-misc mailing list