Mailing List Archive

Virtual hosts and logfiles
Hi.


For fun I'm experimenting with running Varnish in front of an Apache
that runs some virtual hosts; it looks like it is working very well so
far.

Having Varnish in front means that Apache logs the local IP/hostname
for all requests, which makes the logs somewhat less useful than
before.

I wonder if anyone has solved how to make varnishncsa only log
requests to a specific virtualhost? (Then I would just run a
varnishncsa for each virtualhost; problem solved).

Looking at the man-page, I'm guessing that the '-i' flag perhaps could
be used, but I haven't been able to dig up what "tag" means in this
context. Maybe I'm way off.

Any pointers where to look?


Best regards,

Adam

--
"Q: Who tells you what to do? Adam Sj?gren
A: The Bell Telephone Company. The telephone rings asjo at koldfront.dk
and I do what I'm told to do."
Virtual hosts and logfiles [ In reply to ]
In message <87mz1tfnip.fsf at topper.koldfront.dk>, Adam =?iso-8859-1?Q?Sj=F8gren?= writes:

>I wonder if anyone has solved how to make varnishncsa only log
>requests to a specific virtualhost? (Then I would just run a
>varnishncsa for each virtualhost; problem solved).

I am not sure you can do that with varnishncsa at present, but it
should probably grow support for that.

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Virtual hosts and logfiles [ In reply to ]
asjo at koldfront.dk (Adam Sj?gren) writes:
> I wonder if anyone has solved how to make varnishncsa only log
> requests to a specific virtualhost? (Then I would just run a
> varnishncsa for each virtualhost; problem solved).
>
> Looking at the man-page, I'm guessing that the '-i' flag perhaps could
> be used, but I haven't been able to dig up what "tag" means in this
> context. Maybe I'm way off.
>
> Any pointers where to look?

varnishncsa isn't very good at filtering logs, but you can use
varnishlog to filter the logs, and run varnishncsa on the output:

des at dma ~% varnishlog -w /dev/stdout -c RxHeader '^Host: tinderbox.des.no' | varnishncsa -r /dev/stdin
10.0.11.2 - - [04/Apr/2007:11:24:13 +0200] "GET / HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.0.5) Gecko/20060727 Firefox/1.5.0.5"
10.0.11.2 - - [04/Apr/2007:11:24:13 +0200] "GET /tb.css HTTP/1.1" 304 - "http://tinderbox.des.no/" "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.0.5) Gecko/20060727 Firefox/1.5.0.5"

If you don't need continuously updated NCSA logs, it's probably
simpler to just use varnishlog to store raw binary logs to separate
files for each virtual hosts, and run varnishncsa on those files
later.

Ideally, "varnishncsa RxHeader '^Host: tinderbox.des.no'" would do
what you want, but we aren't quite there yet.

DES
--
Dag-Erling Sm?rgrav
Senior Software Developer
Linpro AS - www.linpro.no