[Varnish] #485: Virtualhost logging for varnishncsa

Varnish varnish-bugs at varnish-cache.org
Wed Dec 1 14:00:17 CET 2010


#485: Virtualhost logging for varnishncsa
---------------------------------------------------------+------------------
 Reporter:  rhalff                                       |        Owner:  tfheen
     Type:  enhancement                                  |       Status:  closed
 Priority:  normal                                       |    Milestone:        
Component:  varnishncsa                                  |      Version:  trunk 
 Severity:  normal                                       |   Resolution:  fixed 
 Keywords:  varnishncsa, virtual hosts, apache, logging  |  
---------------------------------------------------------+------------------
Changes (by tfheen):

  * status:  reopened => closed
  * resolution:  => fixed


Old description:

> 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
> /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

New description:

 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
 /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

--

Comment:

 You want %{Host}i, not %v.  See http://www.varnish-
 cache.org/docs/trunk/reference/varnishncsa.html for supported switches.

-- 
Ticket URL: <http://www.varnish-cache.org/trac/ticket/485#comment:6>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list