Virtual hosts and logfiles
Dag-Erling Smørgrav
des at linpro.no
Wed Apr 4 11:27:04 CEST 2007
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
More information about the varnish-misc
mailing list