Shell分析access_log
上一篇 / 下一篇 2010-08-25 15:00:58 / 个人分类:liunx相关
#查看80端口的tcp连接
r3rGG.t0#netstat -tan | grep "ESTABLISHED" | grep ":80" | wc -l51Testing软件测试网,W(HkL-U1o5oX_
1
w}FNFPq0#当前WEB服务器中联接次数最多的ip地址:
1L#Y O n1v8k"r$bez0#netstat -ntu |awk '{print $5}' |sort | uniq -c| sort -n -r51Testing软件测试网|k'Y.Lvu
231 ::ffff:127.0.0.1:809551Testing软件测试网FA*q!E:TfjL
23 ::ffff:192.168.50.201:5432
%hs+Z#[%_~02 ::ffff:192.168.50.203:80
3Q"]{"F@9h01 servers)51Testing软件测试网a'\ R3YFM
1 ::ffff:192.168.50.56:4331451Testing软件测试网vWN5V&O3NAQ;~
1 ::ffff:192.168.50.21:299651Testing软件测试网7_*yJ|L(G
1 ::ffff:192.168.50.21:298951Testing软件测试网Lc9{O d(I;\6g
1 ::ffff:192.168.50.200:806051Testing软件测试网;ShF,n'wdzD4Q
1 ::ffff:192.168.50.12:1300
t9sh A9b9}O01 ::ffff:192.168.50.12:1299
|-zx#`!~]0wP01 ::ffff:192.168.50.12:129851Testing软件测试网fKHG#?[
1 ::ffff:127.0.0.1:57933
2pD.oXp ^%M-U01 Address
'N_$CU!@]01 192.168.50.41:65310
&pMu0a+`3R01 192.168.50.41:64949
r7e`1V YO)d j|01 192.168.50.41:49653
9s$RN+cK,@$G/[E0#查看日志中访问次数最多的前10个IP
@ xo^A&n F0#cat access_log |cut -d ' ' -f 1 |sort |uniq -c | sort -nr | awk '{print $0 }' | head -n 10 |less
LX ?#g)W"n?T014085 121.207.252.12251Testing软件测试网7y pGM7K:zLG!x
13753 218.66.36.11951Testing软件测试网["q_G)z#FF`y
11069 220.162.237.6
y+k;P8h@0cn-E01188 59.63.158.11851Testing软件测试网6a IO5Ul!je
1025 ::1
p/hKuA5G0728 220.231.141.2851Testing软件测试网ydVY`G
655 114.80.126.13951Testing软件测试网m-F)b FDHj
397 117.25.55.100
!p,G i(_2` {0374 222.76.112.21151Testing软件测试网[nK N$wv)E|
348 120.6.214.70
;KJ"? L)[a-x*v0
#查看日志中出现100次以上的IP
#cat access_log |cut -d ' ' -f 1 |sort |uniq -c | awk '{if ($1 > 100) print $0}'|sort -nr |less51Testing软件测试网+U"V$d9\7I w v
14085 121.207.252.122
13753 218.66.36.119
5[X3|6xu;T011069 220.162.237.651Testing软件测试网,G&E%l;V2S3G$l:k$y
1188 59.63.158.11851Testing软件测试网u.NO'OLuO
1025 ::151Testing软件测试网X+b!w?3R\ap1W
728 220.231.141.28
8}/^IG6d0655 114.80.126.139
b:y4K R-rj4{ d0397 117.25.55.10051Testing软件测试网[P@1a[mB^
374 222.76.112.211
~J3V+o.M%Np F[VW0348 120.6.214.7051Testing软件测试网+EX}!Sfl
252 58.211.82.15051Testing软件测试网^E5c_fAc
252 159.226.126.2151Testing软件测试网{8O#n9L bI^'_X#jj.^
206 121.204.57.9451Testing软件测试网'S"Po L7pw
192 59.61.111.5851Testing软件测试网+P P[ q p9[1Q,}
186 218.85.73.4051Testing软件测试网{KWQ T
145 221.231.139.3051Testing软件测试网 lCD1M&E t%k$J
134 121.14.148.220
Z}.B[,NIV3@0123 222.246.128.22051Testing软件测试网O/a,W/|V;o]4U;y
122 61.147.123.4651Testing软件测试网'|X'`wy
119 121.204.105.5851Testing软件测试网0H lb%uPN@x
107 116.9.75.237
]1w&}f j8x2`-m0105 118.123.5.173
/E8DCdv0#查看最近访问量最高的文件51Testing软件测试网|1]^i6i\5H
#cat access_log |tail -10000|awk '{print $7}'|sort|uniq -c|sort -nr|less51Testing软件测试网:an{$ul\|
8729 /server-status?auto
3C;og,@P'D;p'L5fu0618 /51Testing软件测试网$Qsf B^-j?Z
15 /favicon.ico
W0R1nB4Sr012 /manager/html
K XHH0Y"{$PDj010 *51Testing软件测试网#fw/ps5p$Fc
9 /top/icons.gif
5\@j,v*W,Z4yx08 /www.766.com/awstats.www.766.com.html51Testing软件测试网!C6U%d/]"xmr
8 /awstatsicons/other/vv.png
U~KwE ],w(c#^!k08 /awstatsicons/other/vu.png
v sckV|V08 /awstatsicons/other/vp.png51Testing软件测试网{ A)nb4d+Y;~v+n
8 /awstatsicons/other/vk.png51Testing软件测试网O"{v/~v'hP
8 /awstatsicons/other/vh.png51Testing软件测试网6k&VzV#jg
8 /awstatsicons/other/hx.png
v3P5p8c8z vS+H8[g6q08 /awstatsicons/other/hp.png51Testing软件测试网7?'|k;l mP'p^'J2K
8 /awstatsicons/other/hk.png51Testing软件测试网'~*Hp&gr4G2}@ r@
8 /awstatsicons/other/hh.png51Testing软件测试网,R(wu)Lg:L b
8 /awstatsicons/other/he.png51Testing软件测试网%Tt7i*C}sAC)ba3c
8 /awstatsicons/other/awstats_logo6.png51Testing软件测试网4CXf$k(Z _.ig
8 /awstatsicons/os/win.png
K Mer;F&ej08 /awstatsicons/os/unknown.png51Testing软件测试网eN'Ua {?P&G)j
8 /awstatsicons/os/unix.png
T)N3?i`)Ng t08 /awstatsicons/os/symbian.png
2F5s&APs&ChI08 /awstatsicons/os/psp.png51Testing软件测试网x&G.LF+O-`:Ov'e
#查看最近访问量最高的页面(.png)51Testing软件测试网M#BhHD
#cat access_log |awk '{print $7}'|grep '.png'|sort|uniq -c|sort -nr |head -n 10
7?+F-o:z ew0241 /awstatsicons/other/awstats_logo6.png
Z_0Gq(eK wY0227 /awstatsicons/clock/hr12.png
8bly!s;|3H0226 /awstatsicons/other/vv.png51Testing软件测试网9}"sf(EbQwX
226 /awstatsicons/other/vu.png
8jCQD#`'n0226 /awstatsicons/other/vp.png51Testing软件测试网:`p1Q,S j&u
226 /awstatsicons/other/vk.png
,`R6?itUQ G }3g!y0226 /awstatsicons/other/vh.png51Testing软件测试网9R5~:QHp IB k
226 /awstatsicons/clock/hr9.png51Testing软件测试网ZQ:`&D:PbPCru
226 /awstatsicons/clock/hr8.png51Testing软件测试网)ilOu'F N
226 /awstatsicons/clock/hr7.png51Testing软件测试网l)}9V+o g&x{
-d|,ZK5i8@d2o0
#查看日志中访问超过100次的页面51Testing软件测试网? b|u9xS2s,_
#cat access_log | cut -d ' ' -f 7 | sort |uniq -c | awk '{if ($1 > 100) print $0}' | less51Testing软件测试网 K SR(d XKXju
20107 /51Testing软件测试网 P2}0L WC M^@
1027 *
'u-p.dIH(}(]0215 /awstatsicons/browser/chrome.png51Testing软件测试网:]"Km"\6veG
215 /awstatsicons/browser/firefox.png
*_B-I s1BT0136 /awstatsicons/browser/mozilla.png
HLL.t#ogFVI0216 /awstatsicons/browser/msie.png
8I KWB7P0201 /awstatsicons/browser/netscape.png51Testing软件测试网2U(v Ci-txq+L
123 /awstatsicons/browser/notavailable.png51Testing软件测试网o"Q4WpOX
214 /awstatsicons/browser/opera.png51Testing软件测试网(_ujI)?5s5`k:[-U:F
215 /awstatsicons/browser/pdaphone.png51Testing软件测试网WT)U;A0_ Bfl.A2b
214 /awstatsicons/browser/safari.png51Testing软件测试网(Kk!o,k1W^
215 /awstatsicons/browser/unknown.png
'V&nO-q(w^0226 /awstatsicons/clock/hr10.png51Testing软件测试网3j0V[T y2y_hOk
226 /awstatsicons/clock/hr11.png
ea7f/L.qO0227 /awstatsicons/clock/hr12.png
g_!o9? F0225 /awstatsicons/clock/hr1.png51Testing软件测试网OHN|hY
226 /awstatsicons/clock/hr2.png51Testing软件测试网5Oi!c9{E VGp R
226 /awstatsicons/clock/hr3.png
2s,}!sf@5RC#IK^0226 /awstatsicons/clock/hr4.png
X$^W1s6f G/FMa!f.J0226 /awstatsicons/clock/hr5.png
Yb4? [.ir6Fw:S0226 /awstatsicons/clock/hr6.png
0EK&e~;?w0226 /awstatsicons/clock/hr7.png51Testing软件测试网jx'pjo.M{}
226 /awstatsicons/clock/hr8.png51Testing软件测试网"k8_Dl%~ jZ2~.VI yO-s
#access_log昨天一天的点击量(clicks);51Testing软件测试网 R4Cf+X*R\+Z,A"E*mI
cat access_log|grep '12/Nov/2009'|grep "******.jsp"|wc|awk '{print $1}'|uniq51Testing软件测试网g:Z-a*Sej3|0Vk
0
B$@G}+[z-c r0#昨天访问网站的独立IP有多少;51Testing软件测试网^#Y+hC&ur
cat access_log|grep '12/Aug/2009'|grep "******"|wc|awk '{print $1}'|uniq