ðòïåëôù 


  áòèé÷ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  óôáôøé 


  ðåòóïîáìøîïå 


  ðòïçòáííù 



ðéûéôå
ðéóøíá












     áòèé÷ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: counters


  • To: nginx-ru@xxxxxxxxx
  • Subject: Re: counters
  • From: "theromis1" <nginx-forum@xxxxxxxx>
  • Date: Thu, 28 Feb 2013 16:23:43 -0500
  • Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tigger.jlkhosting.com; s=x; h=Date:Sender:From:References:In-Reply-To:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To; bh=VMLzR1IyFQsKoK7xg8fVUCv0FvrgJU6tj1Bs7z1Uj70=; b=N0CP2tWh2gTDmSqRRQCLqZJfzhemJyxnXgs2JWeUdlyNy7G64jM+w0Bufxvbe7qxjy9f5XbZDcPWrttRYoBIIw7pm5gAdF+qV5ZUB7OF5psQjgNxkrr8jrHFTgyc9yaY;
  • In-reply-to: <139986087.20130228233117@softsearch.ru>
  • References: <139986087.20130228233117@softsearch.ru>

ÐÒÉÍÅÒ Ñ ÏÂÎÏ×ÉÌ

========================================================
http {
    # allocating 10Mb for counetr with name "host_counter"
    # and hashing function by $client_ip
    counter_zone  host_counter  $client_ip  10m;

    # same for "hit_counter"
    counter_zone  hit_counter   $client_ip  10m;
 
    ...
 
    server {
 
        ...
 
        location ^~ /some/stats/ {
            counter   host_counter  1; #increase host_counter by one
        }

        location ^~ /some/stats/hit/ {
            counter   hit_counter  3; #increase hit_counter by some other
value
        }

        location ^~ /some/other/stats/ {
            counter   host_counter  $inc_var; #increase counter by some
variable atoi
        }

        location ~* /stats/get_counter/(?P<id>.*)$ {
            counter_get host_counter $counter $id;
            return 200 $counter;
        }

        location ~* /stats/counter_get/(?P<id>.*)$ {
            counter_get host_counter $counter $id;
            return 200 $counter;
        }

        location ~* /stats/counter_drop/(?P<id>.*)$ {
            counter_drop host_counter $id;
        }

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?21,236733,236741#msg-236741

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.