Virtualhost logging for varnishncsa

Rob Halff rob.halff at gmail.com
Fri Apr 3 14:49:09 CEST 2009


Hi,

I've changed the varnishncsa sourcecode to support virtualhost logging.

I know in the TODO of varnishncsa there is a future wish for "Log in
any format one wants",
but I can imagine that would need a total rewrite and takes some time.

So in the meantime I have a request to add the virtualhost logging as
a commandline option.

I've added  a -v flag enabling virtualhost style logging
In this case the logformat looks like:

$ varnishncsa -v
www.test.nl 111.222.333.44 - - [03/Apr/2009:11:41:57 +0200] "GET
http://www.test.nl/favicon.ico HTTP/1.1" 404 209 "-" "Mozilla/4.0
(compatible; MSIE 7.0; Windows NT 5.1; GTB5)"

Notice the 'www.test.nl' being logged.

This is the equivalent of this kind apache logging:

http://httpd.apache.org/docs/2.0/vhosts/mass.html#simple :

    LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon

http://httpd.apache.org/docs/2.0/vhosts/mass.html#simple.rewrite :

    LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon

So this adds the Host part to the normal kind of logging ncsa is doing.

Taken that this is a very common way to log virtual hosts I would say
the -v option is not just some hack to suit my own needs, I think it
is usefull for others also.

Without this I am not able to use awstats the way we used it when we
where not using varnish.

Attached you will find the diff against the current trunk.

Greetings,
Rob Halff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: varnishncsa_virtual_host_patch.diff
Type: application/octet-stream
Size: 1119 bytes
Desc: not available
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20090403/605c8fca/attachment-0004.obj>


More information about the varnish-dev mailing list