Custom counter module(vmod_xcounter)

Guillaume Quintard guillaume at varnish-software.com
Fri Nov 30 18:12:02 UTC 2018


Nice!

-- 
Guillaume Quintard


On Fri, Nov 30, 2018 at 12:14 AM kokoniimasu <kokoniimasu at gmail.com> wrote:

> Hi, All.
>
> I created a vmod_xcounter that can easily add counters.
> I think it can use in various situations.
>
> I'm using vsthrottle together.
>
> - vcl
>
>   vcl 4.0;
>   import xcounter;
>   import vsthrottle;
>
>   sub vcl_init {
>     new atk_login   = xcounter.vsc(hidevclname=1, groupname="attack.");
>     ...
>   }
>
>   sub vcl_recv {
>   ...
>     if(req.method == "POST" &&  req.url ~ ****){
>       if(vsthrottle.is_denied("LOGIN:" + req.http.****, **, 60s)) {
>         atk_login.incr(1);
>         return (synth(429, "Too Many Requests"));
>       }
>   ...
>     }
>   ...
>   }
>
> - output
>
> https://raw.githubusercontent.com/xcir/libvmod-xcounter/master/res/varnishstat.png
>
>
> https://github.com/xcir/libvmod-xcounter
>
> I hope that this vmod is of help to you.
>
> --
> Shohei Tanaka(@xcir)
> http://blog.xcir.net/ (JP)
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20181130/af2ed76a/attachment.html>


More information about the varnish-misc mailing list