1,查看apache進(jìn)程:
ps aux | grep httpd | grep -v grep | wc -l
2,查看80端口的tcp連接:
netstat -tan | grep "ESTABLISHED" | grep ":80" | wc -l
3,通過日志查看當(dāng)天ip連接數(shù),過濾重復(fù):
cat access_log | grep "20/Oct/2008" | awk '{print $2}' | sort | uniq -c | sort -nr
4,當(dāng)天ip連接數(shù)最高的ip都在干些什么(原來(lái)是蜘蛛):
cat access_log | grep "20/Oct/2008:00" | grep "122.102.7.212" | awk '{print $8}' | sort | uniq -c | sort -nr | head -n 10
5,當(dāng)天訪問頁(yè)面排前10的url:
cat access_log | grep "20/Oct/2008:00" | awk '{print $8}' | sort | uniq -c | sort -nr | head -n 10
6,用tcpdump嗅探80端口的訪問看看誰(shuí)最高
tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr
<pre>
接著從日志里查看該ip在干嘛:
<pre lang="php">
cat access_log | grep 122.102.7.212| awk '{print $1"/t"$8}' | sort | uniq -c | sort -nr | less
7,查看某一時(shí)間段的ip連接數(shù):
grep "2006:0[7-8]" www20060723.log | awk '{print $2}' | sort | uniq -c| sort -nr | wc -l
新聞熱點(diǎn)
疑難解答
圖片精選