关于网页访问并发量,统计前十,防火墙
访问网页并发量:
ab -c 100 -n 2000 http://192.168.30.7:9527/
统计网页各IP的访问量:
awk '/[1]/{ip[$1]++}END{for (i in ip){print i,ip[i]}}' /var/log/httpd/access_log
将指定的IP放到防火墙:
iptables -A INPUT -s 192.168.30.6 -j REJECT
将超过指定网页访问量的IP加入到防火墙:
1:
awk '/[2]/{ip[$1]++}END{for(i in ip){if(ip[i]>10000)print i}}' /var/log/httpd/access_log|while read ip;do iptables -A INPUT -s $ip -j REJECT;done
2:
for i in `awk '{ip[$1]++}END{for (i in ip){if (ip[i] >10000) print i}}' /var/log/httpd/access_log`;do
iptables -A INPUT -s $i -j REJECT
done