十五年测试老手,长期负责WEB\APP 项目测试,目前主要负责团队管理工作。

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#YO 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#[%_~0

2 ::ffff:192.168.50.203:80

3Q"]{"F@9h0

1 servers)51Testing软件测试网 a'\R3YFM

1 ::ffff:192.168.50.56:4331451Testing软件测试网v WN5V&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}O0

1 ::ffff:192.168.50.12:1299

|-zx#`!~]0wP0

1 ::ffff:192.168.50.12:129851Testing软件测试网fKHG#?[

1 ::ffff:127.0.0.1:57933

2pD.oXp^%M-U0

1 Address

'N_$CU!@]0

1 192.168.50.41:65310

&pMu0a+`3R0

1 192.168.50.41:64949

r7e`1V YO)d j|0

1 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?T0

14085 121.207.252.12251Testing软件测试网7ypGM7K:zLG!x

13753 218.66.36.11951Testing软件测试网["q_G)z#FF`y

11069 220.162.237.6

y+k;P8h@0cn-E0

1188 59.63.158.11851Testing软件测试网6a IO5Ul!je

1025 ::1

p/hKuA5G0

728 220.231.141.2851Testing软件测试网ydVY `G

655 114.80.126.13951Testing软件测试网m-F)bFDHj

397 117.25.55.100

!p,Gi(_2`{0

374 222.76.112.21151Testing软件测试网[nK N$wv)E|

348 120.6.214.70

;KJ"? L)[a-x*v0


#查看日志中出现100次以上的IP

mg9nBE(Y9P*W4I0

#cat access_log |cut -d ' ' -f 1 |sort |uniq -c | awk '{if ($1 > 100) print $0}'|sort -nr |less51Testing软件测试网+U"V$d9\7I wv


14085 121.207.252.122

0hN:T un Z3j$K a3]0

13753 218.66.36.119

5[X3|6xu;T0

11069 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}/^IG6d0

655 114.80.126.139

b:y4KR-rj4{d0

397 117.25.55.10051Testing软件测试网[P@1a[mB^

374 222.76.112.211

~J3V+o.M%Np F[VW0

348 120.6.214.7051Testing软件测试网+EX}!S fl

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软件测试网{KWQT

145 221.231.139.3051Testing软件测试网 lCD1M&E t%k$J

134 121.14.148.220

Z}.B[,NIV3@0

123 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&}fj8x2`-m0

105 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'L5fu0

618 /51Testing软件测试网$Qsf B^-j?Z

15 /favicon.ico

W0R1nB4S r0

12 /manager/html

K XHH0Y"{$PDj0

10 *51Testing软件测试网#fw/ps5p$Fc

9 /top/icons.gif

5\@ j,v*W,Z4yx0

8 /www.766.com/awstats.www.766.com.html51Testing软件测试网!C6U%d/]"xmr

8 /awstatsicons/other/vv.png

U~Kw E ],w(c#^!k0

8 /awstatsicons/other/vu.png

vsckV| V0

8 /awstatsicons/other/vp.png51Testing软件测试网{A)n b4d+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[g6q0

8 /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软件测试网%T t7i*C}sAC)ba3c

8 /awstatsicons/other/awstats_logo6.png51Testing软件测试网4CXf$k(Z_.ig

8 /awstatsicons/os/win.png

K Mer;F&e j0

8 /awstatsicons/os/unknown.png51Testing软件测试网eN'Ua {?P&G)j

8 /awstatsicons/os/unix.png

T)N3?i`)Ng t0

8 /awstatsicons/os/symbian.png

2F5s&APs&ChI0

8 /awstatsicons/os/psp.png51Testing软件测试网x&G.L F+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 ew0

241 /awstatsicons/other/awstats_logo6.png

Z_0G q(e K wY0

227 /awstatsicons/clock/hr12.png

8bl y!s;|3H0

226 /awstatsicons/other/vv.png51Testing软件测试网9}"sf(EbQwX

226 /awstatsicons/other/vu.png

8jC QD#`'n0

226 /awstatsicons/other/vp.png51Testing软件测试网:`p1Q,S j&u

226 /awstatsicons/other/vk.png

,`R6?itUQ G }3g!y0

226 /awstatsicons/other/vh.png51Testing软件测试网9R5~:QHp IB k

226 /awstatsicons/clock/hr9.png51Testing软件测试网ZQ:`&D:PbPCru

226 /awstatsicons/clock/hr8.png51Testing软件测试网)ilO u'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(dXKX ju

20107 /51Testing软件测试网P2}0L WC M ^@

1027 *

'u-p.dIH(}(]0

215 /awstatsicons/browser/chrome.png51Testing软件测试网:]"Km"\6veG

215 /awstatsicons/browser/firefox.png

*_ B-I s1BT0

136 /awstatsicons/browser/mozilla.png

HLL.t#ogFVI0

216 /awstatsicons/browser/msie.png

8IKWB7P0

201 /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^0

226 /awstatsicons/clock/hr10.png51Testing软件测试网3j0V[T y2y_h Ok

226 /awstatsicons/clock/hr11.png

ea7f/L.qO0

227 /awstatsicons/clock/hr12.png

g _!o9? F0

225 /awstatsicons/clock/hr1.png51Testing软件测试网O HN|hY

226 /awstatsicons/clock/hr2.png51Testing软件测试网5Oi!c9{E VGp R

226 /awstatsicons/clock/hr3.png

2s,}!sf @5RC#IK^0

226 /awstatsicons/clock/hr4.png

X$^W1s6f G/FMa!f.J0

226 /awstatsicons/clock/hr5.png

Yb4? [.ir6Fw:S0

226 /awstatsicons/clock/hr6.png

0EK&e~;?w0

226 /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

Ls0z!K|H7u.Ukk0

194

0q4Xi1R6T ?0

#统计某url,一天的访问次数51Testing软件测试网wa8K*C ^k0PU"S*a

#cat access_log|grep '12/Aug/2009'|grep '/images/index/e1.gif'|wc|awk '{print $1}'

6y{? d$} ?1VV0

2

,I }p*f,~0

#拉出前五天的访问次数最多的网页前20名清单;进行五天日志对比,找出排名靠前重复的网页,即可得出本周访问量最大的前几个网页;

0_ {h){Q,a%H0

#cat access_log|awk '{print $7}'|uniq -c |sort -n -r|head -20

OgC`$u'hE8dP}I8k0

10519 /51Testing软件测试网l"c/[w.F n,Z

654 /manager/html51Testing软件测试网R6gYx5q4Vhp{^

450 /manager/html

?N^o)Z7T0

397 /

7Xd4w6I4bx-Mc-W0

368 /manager/html51Testing软件测试网0m[{KD%` {

304 /51Testing软件测试网Hp!\xw(q(~

280 /manager/html

i Q$Um0r Ok*t"z&u O5z0

279 /51Testing软件测试网r7XI2{rq(\

263 /manager/html

.ud0pQ'uf^0

252 /manager/html51Testing软件测试网FN,E)O$CZl*N5L3{

252 /manager/html

O?jM Lr'Zd0

226 /51Testing软件测试网A5L0be E&b%J2r:Tr;u*o

220 /51Testing软件测试网0Pr4})_K*\o`\

193 /51Testing软件测试网7J,VwI Z3M"v

187 /51Testing软件测试网.mMn+F8l9enb

180 /51Testing软件测试网 | gQ4]4ynr

167 /51Testing软件测试网a0QfSh

166 /51Testing软件测试网9rF)^;I{6B

134 /51Testing软件测试网*]c9H$["Q%s

129 /

5Cj]$L"@9[BU+p&Z0

#从日志里查看该ip在干嘛:51Testing软件测试网h4@&s)d%q+oC

#cat access_log | grep 218.66.36.119| awk '{print $1"\t"$7}' | sort | uniq -c | sort -nr | less

BIX2J&aE e0

243 218.66.36.119 /

hs|(ugzS0

210 218.66.36.119 /awstatsicons/other/awstats_logo6.png

xB)S'k"~ G;i"|;o0

198 218.66.36.119 /awstatsicons/clock/hr12.png51Testing软件测试网S _@D oQ

197 218.66.36.119 /awstatsicons/other/vv.png51Testing软件测试网$p M*F5]T$o8y

197 218.66.36.119 /awstatsicons/other/vu.png

$^3ZGBX0J0

197 218.66.36.119 /awstatsicons/other/vp.png51Testing软件测试网 a,An%| j Mu

197 218.66.36.119 /awstatsicons/other/vk.png

:q4Tc"TS h0

197 218.66.36.119 /awstatsicons/other/vh.png

v/tKAA0

197 218.66.36.119 /awstatsicons/clock/hr9.png

5T%G*DO$h,b1oC0

197 218.66.36.119 /awstatsicons/clock/hr8.png51Testing软件测试网(AZg3ZcB)qMQ

197 218.66.36.119 /awstatsicons/clock/hr7.png

SO ?P3n4{8YF0

197 218.66.36.119 /awstatsicons/clock/hr6.png

4ip`N*nt0

197 218.66.36.119 /awstatsicons/clock/hr5.png51Testing软件测试网9T q@? Ho:O:HA

197 218.66.36.119 /awstatsicons/clock/hr4.png

D2ePHP0X^%Y0

197 218.66.36.119 /awstatsicons/clock/hr3.png

9[N"Gbv s4J D0

197 218.66.36.119 /awstatsicons/clock/hr2.png

E2^eTI!s&i0

197 218.66.36.119 /awstatsicons/clock/hr1.png

L0d b G [p~5VD4c0

197 218.66.36.119 /awstatsicons/clock/hr11.png51Testing软件测试网2[#v8V2bp#v

#列出传输时间超过 30 秒的文件

!sL{4a"A8K0

#cat access_log|awk ‘($NF > 30){print $7}’|sort -n|uniq -c|sort -nr|head -2051Testing软件测试网h ^+Aq)P!|8S

14058 /server-status?auto51Testing软件测试网r+y\;U-j-S k)|

8966 /

&tk] [H!G0

3955 /manager/html51Testing软件测试网-oJ K(YD9oU$DUXZ

1025 *51Testing软件测试网ik rEO

214 /www.766.com/awstats.www.766.com.html

A3J:EH1utU0

211 /awstatsicons/other/awstats_logo6.png

9@#]zVk#Bn0

199 /awstatsicons/clock/hr12.png

%w&LS(Y P!K$A0

198 /awstatsicons/other/vv.png51Testing软件测试网'a2I0P8k!Lc8Ys6k XC

198 /awstatsicons/other/vu.png51Testing软件测试网 zzD6ZY!b\

198 /awstatsicons/other/vp.png

~)MsgH3O0

198 /awstatsicons/other/vk.png51Testing软件测试网/`L_ F J

198 /awstatsicons/other/vh.png51Testing软件测试网n3u%]G2u7] G6q

198 /awstatsicons/clock/hr9.png51Testing软件测试网:kmT&X;I9C

198 /awstatsicons/clock/hr8.png51Testing软件测试网*Ztyw L;Vo

198 /awstatsicons/clock/hr7.png51Testing软件测试网 X0B4V_^5c["G,u

198 /awstatsicons/clock/hr6.png51Testing软件测试网.f3[S'tRS)lq

198 /awstatsicons/clock/hr5.png51Testing软件测试网/\ ?,N,@ ]@|

198 /awstatsicons/clock/hr4.png

]U ma.}X0

198 /awstatsicons/clock/hr3.png51Testing软件测试网v!Z\ {tqg3waR&G

198 /awstatsicons/clock/hr2.png

4pnWDnB0

#列出最最耗时的页面(超过60秒的)的以及对应页面发生次数

sse$Z^0

#cat access_log |awk ‘($NF > 60 && $7~/\.php/){print $7}’|sort -n|uniq -c|sort -nr|head -100

G(y)fCG2v_Lc0

TAG: shell Shell

 

评分:0

我来说两句

Open Toolbar