Varnish and virtual hosting
Kitai
kitai at ya.com
Fri Feb 13 14:49:21 CET 2009
>
>> 3. There doesn't seem to be a way to process live varnishncsa data
>> via a pipe. If this were possible, then I think I would find this whole
>> process a lot easier. Instead, it seems there are two options: to
>> historically dump log data via an option, or run as a daemon and send
>> output to a file (which cannot be via a pipe).
>
> Wrong. Both varnishlog and varnishncsa will, by default, process live
> data and print it to stdout, where you can pipe it to whatever you like.
>
Agree.
You can post-process varnishncsa data to any post-processing program you want.
Or, for example, using Perl ..you may launch the program and take the
output directly to the files you want.
#!/usr/bin/perl
open (COMMAND, "varnishncsa | ") or die "Could not open varnishncsa...\n";
while (<COMMAND>) {
# bla bla bla
print $_; # Print actual line
}
close COMMAND;
Every request is logged with full DN in the URL.
62.151.2.42 - - [29/Jan/2009:16:56:16 +0100] "GET
http://www.FULLDOMAIN.info/static HTTP/1.0" 503 466 "referer"
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR
1.1.4322)"
So it's not difficult to make a program to separate logs depending on
your needs.
Btw, a program in C made by varnish programmers to accomplish this may
be greatly appreciated by the community ;-)
Kitai
More information about the varnish-misc
mailing list