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 ]3HbIT7i1{@8GI0151Testing软件测试网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$C01 servers)51Testing软件测试网f2Q8lp]:V2}+c
1 ::ffff:192.168.50.56:43314
N4bH:xG/b-J01 ::ffff:192.168.50.21:2996
v8yo/q*|c-? vAPI01 ::ffff:192.168.50.21:2989
S l `T| mf!wi01 ::ffff:192.168.50.200:806051Testing软件测试网2N/[f:{-UW-W
1 ::ffff:192.168.50.12:1300
|{sf*R"G01 ::ffff:192.168.50.12:1299
-V_m&V.k7g01 ::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\Zk
14085 121.207.252.12251Testing软件测试网$Y5S%Y%tI&Sv"n2yu
13753 218.66.36.11951Testing软件测试网v,c!MC~f
11069 220.162.237.651Testing软件测试网){K4b;d3S-U.c1{%b.|c)Zh
1188 59.63.158.118
H;`I^W01025 ::1
K5FF)aeze[-p%E0728 220.231.141.28
.O/z_0v9[!|0655 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&~X0348 120.6.214.7051Testing软件测试网[ K#`/X6[.F
#查看日志中出现100次以上的IP
#cat access_log |cut -d ' ' -f 1 |sort |uniq -c | awk '{if ($1 > 100) print $0}'|sort -nr |less51Testing软件测试网V-VOU.G5hI{
14085 121.207.252.122
13753 218.66.36.119
Bk2O\1K8i8J'}P1p011069 220.162.237.651Testing软件测试网2L dhCJ BZN9qH
1188 59.63.158.118
"K a5W1w8Y Q01025 ::151Testing软件测试网 opc{{
728 220.231.141.28
^?dFj/@0655 114.80.126.139
2nj4w9jl#\N$Tg?2]3U;y0397 117.25.55.100
oV;zH"p4V9h:H0374 222.76.112.21151Testing软件测试网,tq\EKZG'n
348 120.6.214.70
Q]2z|3IR9M X0252 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软件测试网+vEyUPJV$Ti{:{X
134 121.14.148.22051Testing软件测试网,ln9Q+b _,y
123 222.246.128.220
I7Y!VDAnJ0122 61.147.123.46
1My,P&bfu YC0119 121.204.105.58
0Kru9b|K2@{ A i(@i!e0107 116.9.75.23751Testing软件测试网;Z#r4@7n C
105 118.123.5.173
Ej1?)|Q*f0#查看最近访问量最高的文件51Testing软件测试网pFe'y8H0c
#cat access_log |tail -10000|awk '{print $7}'|sort|uniq -c|sort -nr|less51Testing软件测试网$\.o M+v~6@
8729 /server-status?auto
j6I?H5A1HT0618 /
NBZo&|3_Wc[,b015 /favicon.ico
(h^ }+N;y{AiTExV012 /manager/html
$S,i+_&cz)u y L/^a5u010 *
&JBRji;G09 /top/icons.gif51Testing软件测试网/gS\ sY
8 /www.766.com/awstats.www.766.com.html51Testing软件测试网`&b3X!x i
8 /awstatsicons/other/vv.png
0Imk!lWm$y08 /awstatsicons/other/vu.png51Testing软件测试网n|E9G0Up0l7e
8 /awstatsicons/other/vp.png51Testing软件测试网4bB[9w$~l
8 /awstatsicons/other/vk.png
Mj sU-@!PX%Ni]08 /awstatsicons/other/vh.png
d`M_/t%A08 /awstatsicons/other/hx.png51Testing软件测试网A2WU$IJ iL
8 /awstatsicons/other/hp.png51Testing软件测试网pq X S"H]
8 /awstatsicons/other/hk.png
HM0ffA h(G Q:y08 /awstatsicons/other/hh.png
N1i:GKCv#d08 /awstatsicons/other/he.png51Testing软件测试网!jY6?Q6M Y2Y0DkX
8 /awstatsicons/other/awstats_logo6.png
M1[` ].Hp;\08 /awstatsicons/os/win.png51Testing软件测试网oN Pkd!WLY
8 /awstatsicons/os/unknown.png51Testing软件测试网:r#[#_Q w(A
8 /awstatsicons/os/unix.png51Testing软件测试网/e3sRMf,j0p!_sI
8 /awstatsicons/os/symbian.png
x0|]4u&W7xm:h\08 /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 ~x0241 /awstatsicons/other/awstats_logo6.png
1Tk5SEQ0227 /awstatsicons/clock/hr12.png
\uYJ9n+s&q1RkH0226 /awstatsicons/other/vv.png
O_C(mmTOE5QJbT0226 /awstatsicons/other/vu.png51Testing软件测试网 JDb0C7N~TX
226 /awstatsicons/other/vp.png
J#Hq$f9N9ra{ jY0226 /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@I04GD,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/uU h
20107 /
e8dAr kp8f!QK01027 *51Testing软件测试网0s5y*y ~6LD
215 /awstatsicons/browser/chrome.png51Testing软件测试网T0N'Y{ehz
215 /awstatsicons/browser/firefox.png
V j;B(e&N*Z0136 /awstatsicons/browser/mozilla.png51Testing软件测试网 _DF%R6zE1L%B?#oPx
216 /awstatsicons/browser/msie.png
#t+[5xk7yj+U y0201 /awstatsicons/browser/netscape.png
f1cI#n8Q+Ul]k0123 /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`3WG0215 /awstatsicons/browser/unknown.png
GZD4tD2^(a0226 /awstatsicons/clock/hr10.png51Testing软件测试网d#rr g:Z)z9m,xh
226 /awstatsicons/clock/hr11.png
#_4o)D zM0M0227 /awstatsicons/clock/hr12.png51Testing软件测试网'}1hF$CiE-@h_m
225 /awstatsicons/clock/hr1.png51Testing软件测试网n} f/jl3C
226 /awstatsicons/clock/hr2.png51Testing软件测试网| cs,d6`"e1b
226 /awstatsicons/clock/hr3.png
Yz|$r:\rn;ar-U0226 /awstatsicons/clock/hr4.png51Testing软件测试网&o @2R4YZ:tz2Q
226 /awstatsicons/clock/hr5.png
F#`6y!P|e:kiu |#^0226 /awstatsicons/clock/hr6.png51Testing软件测试网&]-KN$kHIP6p
226 /awstatsicons/clock/hr7.png51Testing软件测试网'F-q:JGVaezo:q
226 /awstatsicons/clock/hr8.png51Testing软件测试网Wt0Gl!|3Ew)@4X7^
#access_log昨天一天的点击量(clicks);
8D-l&Khg0cat 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!jes wa
cat access_log|grep '12/Aug/2009'|grep "******"|wc|awk '{print $1}'|uniq51Testing软件测试网^*hl@#Dc-Xsd
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,_3g K0#拉出前五天的访问次数最多的网页前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 A0450 /manager/html51Testing软件测试网1l\$qJV&^,|ms$`
397 /
jj)O2G8?P#cz0368 /manager/html51Testing软件测试网4d E&R}?
304 /51Testing软件测试网nuu-WN
280 /manager/html
L4|_V;G9Xs0279 /51Testing软件测试网R`m5BF
263 /manager/html51Testing软件测试网k$V}S` X0W
252 /manager/html51Testing软件测试网8f @3n O6C
252 /manager/html
"u!b M t`J0226 /51Testing软件测试网.u:r/~ Hg
220 /
Og){!ZM0193 /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_\;iUP [li0134 /
e'r$o:qK#V0129 /51Testing软件测试网*RghrLJ
#从日志里查看该ip在干嘛:
]6t)| f_0#cat access_log | grep 218.66.36.119| awk '{print $1"\t"$7}' | sort | uniq -c | sort -nr | less51Testing软件测试网j4Xbf2Vj1c
243 218.66.36.119 /
Ng*wysqC0210 218.66.36.119 /awstatsicons/other/awstats_logo6.png51Testing软件测试网2z`Ij$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] `H0197 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.Bj(?4K!D0197 218.66.36.119 /awstatsicons/other/vh.png51Testing软件测试网0H%zd-lH&M~
197 218.66.36.119 /awstatsicons/clock/hr9.png
.R0qIw!a'kA;sb0197 218.66.36.119 /awstatsicons/clock/hr8.png
-B-E]l*V)O0197 218.66.36.119 /awstatsicons/clock/hr7.png
z(s d JQn0197 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_USODg EA0197 218.66.36.119 /awstatsicons/clock/hr3.png51Testing软件测试网^$MUPNe~
197 218.66.36.119 /awstatsicons/clock/hr2.png
J8@D.G\{m*}0197 218.66.36.119 /awstatsicons/clock/hr1.png51Testing软件测试网;RzcD,M)t
197 218.66.36.119 /awstatsicons/clock/hr11.png51Testing软件测试网Y-S dw]#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 |014058 /server-status?auto51Testing软件测试网K4P L"u%M8_2y-qwb
8966 /
An`$RR6Nd6A03955 /manager/html
GvB;{$J[{C k01025 *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 v0c0199 /awstatsicons/clock/hr12.png
Ggn? u0198 /awstatsicons/other/vv.png51Testing软件测试网 J{+G `4c
198 /awstatsicons/other/vu.png51Testing软件测试网'o*w1aE ZY _
198 /awstatsicons/other/vp.png
2M$GUU4|I3BD0198 /awstatsicons/other/vk.png
4x7?n7n B#m*V0198 /awstatsicons/other/vh.png51Testing软件测试网_ }l+j{
198 /awstatsicons/clock/hr9.png51Testing软件测试网ic1ip:q!@*w
198 /awstatsicons/clock/hr8.png
.d e ^G&AnK/X0198 /awstatsicons/clock/hr7.png
H4\v }i U0198 /awstatsicons/clock/hr6.png
j/lu E(LnC0198 /awstatsicons/clock/hr5.png51Testing软件测试网8ob(xd7B U&B})w$h `6]
198 /awstatsicons/clock/hr4.png51Testing软件测试网8o({-`:kXk1^
198 /awstatsicons/clock/hr3.png51Testing软件测试网%w*S;pj!@(o%oR
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
相关阅读:
- shell的初始化文件:/etc/profile和/etc/bashrc(bash.bashrc) (smile665, 2010-7-05)
- 交互式shell和非交互式shell、登录shell和非登录shell的区别 (smile665, 2010-7-09)
- Shell处理字符串常用方法 (smile665, 2010-8-02)
- Shell处理字符串常用方法 (xin_晴, 2010-8-03)
- 2>&1 浅析 (wzstar2008, 2010-8-20)
生活在互联网领域,从事WEB测试工作.
我的栏目
标题搜索
日历
|
|||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
1 | 2 | 3 | 4 | ||||||
5 | 6 | 7 | 8 | 9 | 10 | 11 | |||
12 | 13 | 14 | 15 | 16 | 17 | 18 | |||
19 | 20 | 21 | 22 | 23 | 24 | 25 | |||
26 | 27 | 28 | 29 | 30 | 31 |
我的存档
数据统计
- 访问量: 1696525
- 日志数: 556
- 图片数: 1
- 文件数: 3
- 书签数: 8
- 建立时间: 2007-06-08
- 更新时间: 2023-01-07