Forum Discussion
Robert_47833
Dec 07, 2011Altostratus
how to gather how many IPs hit the url and how many times
Hi,dear irule
I meet a new requirement recently
there is an URL: http://cjj.cjj.com/select
I wanna gather the stats :
how many IPs hit this url: such as ,10.0.0.1 ;10.0.0.2;10.0.0.3
how many times per each ip hit this as 10.0.0.1 10 times
10.0.0.2 200times
10.0.0.3 1times
how to achieve this
thanks very much
- Robert_47833Altostratusthe period may be one month ,it is only the current stats,I need a long term stats
- nitassEmployeehave you seen table command article by Spark? there are good counting examples there.
- Robert_47833Altostratushmm,I am not sure whether table command will reslove this
- Robert_47833Altostratusgive u show me an simple example
- hooleylistCirrostratusHi Jucao,
- Robert_47833Altostratuscan we use STATS profile to achieve this?
- Robert_47833Altostratusor table command to achieve this?
- HamishCirrocumulusYes. You can use the tables. But be aware that although the tables are good, keeping stats in there for a month is probably overkill. And you don't need to.
- HamishCirrocumulusI'll try & expand on that in a while... Sorry...
- nitassEmployeethis is counted for 60 seconds. please feel free to revise.
[root@ve1023:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve1023:Active] config b rule myrule list rule myrule { when CLIENT_ACCEPTED { table set -subtable "iplist" [IP::client_addr] "ignored" set reqno [table incr "reqs:[IP::client_addr]"] table set -subtable "reqrate:[IP::client_addr]" $reqno "ignored" indefinite 60 } when HTTP_REQUEST { if {[string tolower [HTTP::uri]] equals "/stats"} { set stats "ip,request number\n" foreach ip [table keys -subtable "iplist"] { append stats "$ip,[table keys -count -subtable "reqrate:$ip"]\n" } HTTP::respond 200 Content $stats } } } [root@ve1023:Active] config curl -i http://172.28.19.79/stats HTTP/1.0 200 OK Server: BigIP Connection: Keep-Alive Content-Length: 67 ip,request number 172.28.19.80,12 192.168.181.16,5 172.28.19.253,2
Recent Discussions
Related Content
Â
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects