Virtual hosts and logfiles
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:18.104.22.168) Gecko/20060727 Firefox/22.214.171.124"
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:126.96.36.199) Gecko/20060727 Firefox/188.8.131.52"
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
Ideally, "varnishncsa RxHeader '^Host: tinderbox.des.no'" would do
what you want, but we aren't quite there yet.
Senior Software Developer
Linpro AS - www.linpro.no
More information about the varnish-misc