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

Shell分析access_log

上一篇 / 下一篇  2010-08-25 15:00:58 / 个人分类:liunx相关

#查看80端口的tcp连接

,EO#`5d9^H;Es(X0

#netstat -tan | grep "ESTABLISHED" | grep ":80" | wc -l

d ]3H bIT7i1{@8GI0

151Testing软件测试网XH'XDb#ag|}

#当前WEB服务器中联接次数最多的ip地址:51Testing软件测试网P!Ug Y+zc;B

#netstat -ntu |awk '{print $5}' |sort | uniq -c| sort -n -r51Testing软件测试网x8f%@y;t'`W

231 ::ffff:127.0.0.1:809551Testing软件测试网_N&h/qj,]"j

23 ::ffff:192.168.50.201:543251Testing软件测试网5s^8RP-w

2 ::ffff:192.168.50.203:80

@ |j5g h+?^Kt$C0

1 servers)51Testing软件测试网f2Q8lp]:V2}+c

1 ::ffff:192.168.50.56:43314

N4bH:xG/b-J0

1 ::ffff:192.168.50.21:2996

v8yo/q*|c-? vAPI0

1 ::ffff:192.168.50.21:2989

S l `T| mf!wi0

1 ::ffff:192.168.50.200:806051Testing软件测试网2N/[f:{-UW-W

1 ::ffff:192.168.50.12:1300

|{sf*R"G0

1 ::ffff:192.168.50.12:1299

-V_m&V.k7g0

1 ::ffff:192.168.50.12:129851Testing软件测试网7?V^Z.`

1 ::ffff:127.0.0.1:5793351Testing软件测试网2K+T.u}p9m5K

1 Address51Testing软件测试网4E,Z9|0Ix,og P+nz

1 192.168.50.41:6531051Testing软件测试网w6ao5L nI6M&f

1 192.168.50.41:6494951Testing软件测试网i(]my_4o,|(K c;z

1 192.168.50.41:49653

*sRL(t!J0

#查看日志中访问次数最多的前10个IP

U$o0a1h'n ?mb/id.m7`0

#cat access_log |cut -d ' ' -f 1 |sort |uniq -c | sort -nr | awk '{print $0 }' | head -n 10 |less51Testing软件测试网x*O"p4\Z k

14085 121.207.252.12251Testing软件测试网$Y5S%Y%tI&Sv"n2yu

13753 218.66.36.11951Testing软件测试网v,c!M C~f

11069 220.162.237.651Testing软件测试网){K4b;d3S-U.c1{%b.|c)Zh

1188 59.63.158.118

H;` I^W0

1025 ::1

K5FF)aeze[-p%E0

728 220.231.141.28

.O/z_0v9[!|0

655 114.80.126.13951Testing软件测试网1\]{?/gYP#F.d

397 117.25.55.10051Testing软件测试网 G g"ByH.j%^

374 222.76.112.211

8| U Q;e oE&~X0

348 120.6.214.7051Testing软件测试网[K#`/X6[.F


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

\l)h2S{"~.p UN/m0

#cat access_log |cut -d ' ' -f 1 |sort |uniq -c | awk '{if ($1 > 100) print $0}'|sort -nr |less51Testing软件测试网V-VO U.G5hI{


14085 121.207.252.122

@Po4kP#zwe0

13753 218.66.36.119

Bk2O \1K8i8J'}P1p0

11069 220.162.237.651Testing软件测试网2L dhCJ BZ N9qH

1188 59.63.158.118

"K a5W1w8Y Q0

1025 ::151Testing软件测试网 opc {{

728 220.231.141.28

^?dFj/@0

655 114.80.126.139

2nj4w9jl#\N$Tg?2]3U;y0

397 117.25.55.100

o V;zH"p4V9h:H0

374 222.76.112.21151Testing软件测试网,tq\EKZ G'n

348 120.6.214.70

Q ]2z|3IR9M X0

252 58.211.82.15051Testing软件测试网"tLmN'Bo(N&M

252 159.226.126.2151Testing软件测试网y4riQW {V

206 121.204.57.9451Testing软件测试网1T-W6@L|7d

192 59.61.111.5851Testing软件测试网k-q;rsS

186 218.85.73.4051Testing软件测试网%O$xqBo+N

145 221.231.139.3051Testing软件测试网+vE y UPJV$Ti{:{X

134 121.14.148.22051Testing软件测试网,ln9Q+b _,y

123 222.246.128.220

I7Y!V DAnJ0

122 61.147.123.46

1M y,P&bf u Y C0

119 121.204.105.58

0Kru9b|K2@{ A i(@i!e0

107 116.9.75.23751Testing软件测试网;Z#r4@7n C

105 118.123.5.173

Ej1?)|Q*f0

#查看最近访问量最高的文件51Testing软件测试网p Fe'y8H0c

#cat access_log |tail -10000|awk '{print $7}'|sort|uniq -c|sort -nr|less51Testing软件测试网$\.o M+v~6@

8729 /server-status?auto

j6I ?H5A1HT0

618 /

NBZo&|3_Wc[,b0

15 /favicon.ico

(h^ }+N;y{AiTExV0

12 /manager/html

$S,i+_&cz)uyL/^a5u0

10 *

&JBRji;G0

9 /top/icons.gif51Testing软件测试网/gS\ sY

8 /www.766.com/awstats.www.766.com.html51Testing软件测试网`&b3X!x i

8 /awstatsicons/other/vv.png

0Imk!lWm$y0

8 /awstatsicons/other/vu.png51Testing软件测试网n|E9G0Up0l7e

8 /awstatsicons/other/vp.png51Testing软件测试网4bB[9w$~l

8 /awstatsicons/other/vk.png

M j sU-@!PX%N i]0

8 /awstatsicons/other/vh.png

d`M_/t%A0

8 /awstatsicons/other/hx.png51Testing软件测试网A2W U$IJiL

8 /awstatsicons/other/hp.png51Testing软件测试网pqXS"H]

8 /awstatsicons/other/hk.png

HM0ffA h(G Q:y0

8 /awstatsicons/other/hh.png

N1i:GK Cv#d0

8 /awstatsicons/other/he.png51Testing软件测试网!jY6?Q6M Y2Y0DkX

8 /awstatsicons/other/awstats_logo6.png

M1[ ` ].H p;\0

8 /awstatsicons/os/win.png51Testing软件测试网oNPkd!WLY

8 /awstatsicons/os/unknown.png51Testing软件测试网:r#[#_Qw(A

8 /awstatsicons/os/unix.png51Testing软件测试网/e3sRMf,j0p!_sI

8 /awstatsicons/os/symbian.png

x0|]4u&W7xm:h\0

8 /awstatsicons/os/psp.png51Testing软件测试网gE#p}R~r

#查看最近访问量最高的页面(.png)

+A%@6Z'Y!Q*xA+h0L0

#cat access_log |awk '{print $7}'|grep '.png'|sort|uniq -c|sort -nr |head -n 10

5WOEXQ|:j3L.S~x0

241 /awstatsicons/other/awstats_logo6.png

1Tk5SEQ0

227 /awstatsicons/clock/hr12.png

\uYJ9n+s&q1RkH0

226 /awstatsicons/other/vv.png

O_ C(mmTOE5Q JbT0

226 /awstatsicons/other/vu.png51Testing软件测试网 J Db0C7N~TX

226 /awstatsicons/other/vp.png

J#Hq$f9N9ra{ jY0

226 /awstatsicons/other/vk.png51Testing软件测试网@}yD7o E

226 /awstatsicons/other/vh.png51Testing软件测试网;KvIQ2qn

226 /awstatsicons/clock/hr9.png51Testing软件测试网y_1{,wRHY&Kc

226 /awstatsicons/clock/hr8.png51Testing软件测试网k G-X Y N'K`L2a_Z

226 /awstatsicons/clock/hr7.png

%hr\HP@I0

 

4GD,b;t"}gV0

#查看日志中访问超过100次的页面51Testing软件测试网4d-N[ ]Y"E

#cat access_log | cut -d ' ' -f 7 | sort |uniq -c | awk '{if ($1 > 100) print $0}' | less51Testing软件测试网PY-|gjv/u U h

20107 /

e8dAr k p8f!QK0

1027 *51Testing软件测试网0s5y*y ~6LD

215 /awstatsicons/browser/chrome.png51Testing软件测试网T0N'Y{ehz

215 /awstatsicons/browser/firefox.png

V j;B(e&N*Z0

136 /awstatsicons/browser/mozilla.png51Testing软件测试网 _DF%R6zE1L%B?#oPx

216 /awstatsicons/browser/msie.png

#t+[5xk7yj+U y0

201 /awstatsicons/browser/netscape.png

f1cI#n8Q+Ul]k0

123 /awstatsicons/browser/notavailable.png51Testing软件测试网,LL0n)d3BT8} iA8}f

214 /awstatsicons/browser/opera.png51Testing软件测试网 ^R9\3mk

215 /awstatsicons/browser/pdaphone.png51Testing软件测试网Q9v*UJ.z:x|3y,l4Pb

214 /awstatsicons/browser/safari.png

u;jU3`3WG0

215 /awstatsicons/browser/unknown.png

GZD4tD2^(a0

226 /awstatsicons/clock/hr10.png51Testing软件测试网d#rr g:Z)z9m,xh

226 /awstatsicons/clock/hr11.png

#_4o)DzM0M0

227 /awstatsicons/clock/hr12.png51Testing软件测试网'}1hF$CiE-@h_m

225 /awstatsicons/clock/hr1.png51Testing软件测试网n} f/jl3C

226 /awstatsicons/clock/hr2.png51Testing软件测试网| c s,d6`"e1b

226 /awstatsicons/clock/hr3.png

Yz|$r:\rn;ar-U0

226 /awstatsicons/clock/hr4.png51Testing软件测试网&o @2R4YZ:tz2Q

226 /awstatsicons/clock/hr5.png

F#`6y!P|e:kiu |#^0

226 /awstatsicons/clock/hr6.png51Testing软件测试网&]-KN$kHIP6p

226 /awstatsicons/clock/hr7.png51Testing软件测试网'F-q:J GVaezo:q

226 /awstatsicons/clock/hr8.png51Testing软件测试网Wt0Gl!|3Ew)@4X7^

#access_log昨天一天的点击量(clicks);

8D-l&Khg0

cat access_log|grep '12/Nov/2009'|grep "******.jsp"|wc|awk '{print $1}'|uniq51Testing软件测试网!wl uj y S

051Testing软件测试网PF"IOK%u0k;\RAm_

#昨天访问网站的独立IP有多少;51Testing软件测试网:ZB!je swa


cat access_log|grep '12/Aug/2009'|grep "******"|wc|awk '{print $1}'|uniq51Testing软件测试网^*hl@#Dc-Xs d

194

o3dF C;Z1T(J0

#统计某url,一天的访问次数51Testing软件测试网#v,ora'u+cT0H

#cat access_log|grep '12/Aug/2009'|grep '/images/index/e1.gif'|wc|awk '{print $1}'51Testing软件测试网$` D7ck s9h.}U

2

8Sd*U,_3gK0

#拉出前五天的访问次数最多的网页前20名清单;进行五天日志对比,找出排名靠前重复的网页,即可得出本周访问量最大的前几个网页;51Testing软件测试网1b)Agm,sA,b`'\5w

#cat access_log|awk '{print $7}'|uniq -c |sort -n -r|head -2051Testing软件测试网 ER@%`$|4| d6h

10519 /51Testing软件测试网ywT,vA^

654 /manager/html

W{#P({3F!jcQ;N A0

450 /manager/html51Testing软件测试网1l\$qJV&^,|ms$`

397 /

j j)O2G8?P#cz0

368 /manager/html51Testing软件测试网4dE&R}?

304 /51Testing软件测试网nuu-WN

280 /manager/html

L4|_V;G9Xs0

279 /51Testing软件测试网R`m5BF

263 /manager/html51Testing软件测试网k$V}S` X0W

252 /manager/html51Testing软件测试网8f @3n O6C

252 /manager/html

"u!bMt`J0

226 /51Testing软件测试网.u:r/~ Hg

220 /

O g){!ZM0

193 /51Testing软件测试网EL:s2Is2u/}

187 /51Testing软件测试网h7{l0g'M%d&t r4[4t

180 /51Testing软件测试网~Nv&^4B:qNUb!z

167 /51Testing软件测试网 Ru Q8Nd,}

166 /

+DMK*}W_ \;i UP[li0

134 /

e'r$o:qK#V0

129 /51Testing软件测试网*R g hrLJ

#从日志里查看该ip在干嘛:

]6t)| f_0

#cat access_log | grep 218.66.36.119| awk '{print $1"\t"$7}' | sort | uniq -c | sort -nr | less51Testing软件测试网j4Xb f2Vj1c

243 218.66.36.119 /

Ng*wysqC0

210 218.66.36.119 /awstatsicons/other/awstats_logo6.png51Testing软件测试网2z`I j$t#q ]

198 218.66.36.119 /awstatsicons/clock/hr12.png51Testing软件测试网:]1s7UG)X4P9m+~ngr0P

197 218.66.36.119 /awstatsicons/other/vv.png

%bA"]"i] `H0

197 218.66.36.119 /awstatsicons/other/vu.png51Testing软件测试网.e&Oa4XWN

197 218.66.36.119 /awstatsicons/other/vp.png51Testing软件测试网 a#^*fD7i'n1Tx!zz x

197 218.66.36.119 /awstatsicons/other/vk.png

&|7e L7@/TW.B j(?4K!D0

197 218.66.36.119 /awstatsicons/other/vh.png51Testing软件测试网0H%zd-lH&M~

197 218.66.36.119 /awstatsicons/clock/hr9.png

.R0qIw!a'kA;sb0

197 218.66.36.119 /awstatsicons/clock/hr8.png

-B-E]l*V)O0

197 218.66.36.119 /awstatsicons/clock/hr7.png

z(s d JQn0

197 218.66.36.119 /awstatsicons/clock/hr6.png51Testing软件测试网'xD6a3E"BH |

197 218.66.36.119 /awstatsicons/clock/hr5.png51Testing软件测试网;a h5qAs8p}p

197 218.66.36.119 /awstatsicons/clock/hr4.png

;s_US ODg EA0

197 218.66.36.119 /awstatsicons/clock/hr3.png51Testing软件测试网^$MUPNe~

197 218.66.36.119 /awstatsicons/clock/hr2.png

J8@D.G\{m*}0

197 218.66.36.119 /awstatsicons/clock/hr1.png51Testing软件测试网;RzcD,M)t

197 218.66.36.119 /awstatsicons/clock/hr11.png51Testing软件测试网Y-Sdw ]#a

#列出传输时间超过 30 秒的文件51Testing软件测试网,F,Xln@OT/B&y

#cat access_log|awk ‘($NF > 30){print $7}’|sort -n|uniq -c|sort -nr|head -20

OOp-h;_&t,GJ|0

14058 /server-status?auto51Testing软件测试网K4P L"u%M8_2y-qwb

8966 /

An`$RR6Nd6A0

3955 /manager/html

GvB;{$J[{C k0

1025 *51Testing软件测试网;A(v"g2l9`je*]

214 /www.766.com/awstats.www.766.com.html51Testing软件测试网s @ ~"m T!_

211 /awstatsicons/other/awstats_logo6.png

Uw \Q$[ o&D I v0c0

199 /awstatsicons/clock/hr12.png

Ggn? u0

198 /awstatsicons/other/vv.png51Testing软件测试网J{+G `4c

198 /awstatsicons/other/vu.png51Testing软件测试网'o*w1aE ZY _

198 /awstatsicons/other/vp.png

2M$GUU4|I3BD0

198 /awstatsicons/other/vk.png

4x7?n7n B#m*V0

198 /awstatsicons/other/vh.png51Testing软件测试网_ }l+j{

198 /awstatsicons/clock/hr9.png51Testing软件测试网ic1ip:q!@*w

198 /awstatsicons/clock/hr8.png

.de ^G&AnK/X0

198 /awstatsicons/clock/hr7.png

H4\v}i U0

198 /awstatsicons/clock/hr6.png

j/lu E(LnC0

198 /awstatsicons/clock/hr5.png51Testing软件测试网8ob(xd7BU&B})w$h `6]

198 /awstatsicons/clock/hr4.png51Testing软件测试网8o({-`:kXk1^

198 /awstatsicons/clock/hr3.png51Testing软件测试网%w*S;pj!@(o%o R

198 /awstatsicons/clock/hr2.png51Testing软件测试网G#L(yfFqD

#列出最最耗时的页面(超过60秒的)的以及对应页面发生次数51Testing软件测试网/WyK[1Hs&HmGOj

#cat access_log |awk ‘($NF > 60 && $7~/\.php/){print $7}’|sort -n|uniq -c|sort -nr|head -10051Testing软件测试网7| e|.IUv2~d


TAG: shell Shell

 

评分:0

我来说两句

Open Toolbar