Apache日誌分析指令碼

2021-08-30 06:00:08 字數 882 閱讀 7947

1,檢視apache程序:

2,檢視80埠的tcp連線:

netstat -tan | grep "established" | grep ":80" | wc -l

3,通過日誌檢視當天ip連線數,過濾重複:

cat access_log | grep "20/oct/2008" | awk '' | sort | uniq -c | sort -nr

4,當天ip連線數最高的ip都在幹些什麼(原來是蜘蛛):

cat access_log | grep "20/oct/2008:00" | grep "122.102.7.212" | awk '' | sort | uniq -c | sort -nr | head -n 10

5,當天訪問頁面排前10的url:

cat access_log | grep "20/oct/2008:00" | awk '' | sort | uniq -c | sort -nr | head -n 10

6,用tcpdump嗅探80埠的訪問看看誰最高

tcpdump -i eth0 -tnn dst port 80 -c 1000 | awk -f"." '' | sort | uniq -c | sort -nr

接著從日誌裡檢視該ip在幹嘛:

cat access_log | grep 122.102.7.212| awk '' | sort | uniq -c | sort -nr | less

7,檢視某一時間段的ip連線數:

grep "2006:0[7-8]" www20060723.log | awk '' | sort | uniq -c| sort -nr | wc -l

python指令碼分析apache訪問日誌

編寫count patt.py指令碼,實現乙個apche日誌分析指令碼 統計每個客戶端訪問apache伺服器的次數 將統計資訊通過字典的方式顯示出來 分別統計客戶端是firefox和msie的訪問次數 分別使用函式式程式設計和物件導向程式設計的方式實現 collections是python內建的乙個...

Apache日誌分析

1 獲得訪問前10位的ip位址 cataccess.log awk sort uniq c sort nr head 10 cat access.log awk end 2 訪問次數最多的檔案或頁面,取前20及統計所有訪問ip cat access.log awk sort uniq c sort ...

apache日誌分析

1,檢視apache程序 2,檢視80埠的tcp連線 netstat tan grep established grep 80 wc l 3,通過日誌檢視當天ip連線數,過濾重複 cat access log grep 20 oct 2008 awk sort uniq c sort nr 4,當天...