Custom counter module(vmod_xcounter)

kokoniimasu kokoniimasu at gmail.com
Sat Dec 1 04:55:03 UTC 2018


Thanks!
2018年12月1日(土) 3:12 Guillaume Quintard <guillaume at varnish-software.com>:
>
> 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


More information about the varnish-misc mailing list