Regarding url purging

Gaute Amundsen gaute at pht.no
Thu Jul 5 20:13:24 CEST 2007


On Thursday 05 July 2007 19:39, André Cruz wrote:
> Hello.
>
> I'm caching pages from different vhosts, say x.com and y.com.
>
> If I want to purge all the data from one of the vhosts how do I do
> it? "url.purge x.com.*" does not work. I'm a bit confused with the
> syntax since the wiki only talks about paths and not complete URLs.

That's not easily done, as far as I have been able to determine.
I've submitted a feature request for it..

As I understand it, you can only use hostname as part of the url when you 
purge by http, but then no wildcards.
You can use full regexps when purging on the console, but then only the path 
is available to match against.

I guess a workaround would be parse the log to make a list of all urls served 
within the expiery limit, do your filtering on that list, and then purge all 
the matching urls one by one by http.

The nsca log contains the full url including host, which i think is somewhat 
unusual, so grepping for that should not be too hard.

Here is the pipe I use to get host as a separate column, that should be a 
start.

/usr/bin/varnishncsa -c -r /var/log/varnish/varnish.log | \
sed -e 's#\("\([A-Z]\+\) \(http://\([^/]*\)\)\(.*\)\)#\4 "\2 \5#g' \


Gaute



More information about the varnish-misc mailing list