Collecting varnish stats at the Url Level

Debraj Manna subharaj.manna at gmail.com
Tue May 3 19:29:43 CEST 2016


Thanks Thomas.
On May 2, 2016 11:22 AM, "Thomas Lecomte" <thomas.lecomte at virtual-expo.com>
wrote:

> On Mon, May 2, 2016 at 7:00 AM, Debraj Manna <subharaj.manna at gmail.com>
> wrote:
> > Thanks Thomas.
> >
> > How can I maintain a counter per url. In vcl_deliver obj.hits will again
> > give me the overall hits.
>
> As I said, you have to implement this yourself using VCL and varnishncsa.
>
> Example of VCL:
>
>       # 38. match rule for PDF pages
>       if (req.url ~ "^\/pdf\/([^\/]+)\-(\d+)\.html$")
>       {
>         set req.http.X-MatchRule = "38";
>         return (hash);
>       }
>       [...]
>       std.log("MR:" + req.http.X-MatchRule);
>
> Then, call varnishncsa with -F and %{VCL_Log:MR} plus
> %{Varnish:handling} to log the match rule and the handling of the
> request (miss, hit, pipe, pass, whatever). You will have to parse this
> output yourself to compute a ratio.
>
> --
> Thomas Lecomte / Virtual Expo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20160503/3b9139c1/attachment.html>


More information about the varnish-misc mailing list