小试nginx日志分析xlog

nginx配置:

 1 http {
 2     #...其他配置
 3     log_format  tpynormal  '$remote_addr | [$time_local] | $host | "$request" | '
 4                             '$status | $body_bytes_sent | "$http_referer" | '
 5                             '"$http_user_agent" | "$http_x_forwarded_for" | '
 6                             '$upstream_addr | $upstream_status | $upstream_response_time | '
 7                             '$server_addr |$http_cookie|$request_time| ';
 8     server {
 9         #...其他配置
10         access_log  /datas/log/www/access.abc_tp.log  tpynormal;
11     }
12 }

脚本下载:http://pan.baidu.com/s/1bGAXEQ

使用及结果:

 1 [root@localhost ~]# cat /datas/log/www/access.abc_tp.log | ./xlog
 2 No filter
 3 Log  count   total:                  247, filtered:                    0, rate: 0.000000
 4 Body bytes   total:               388079, filtered:                    0, rate: 0.000000
 5 Time seconds total:             17.71900, filtered:              0.00000, rate: 0.000000
 6 Time average total:              0.07174, filtered:                  NaN
 7 Time dist    total:              filtered:
 8           <0.05        113, 45.749%
 9        0.05-0.1        103, 41.700%
10         0.1-0.2         26, 10.526%
11           0.5-1          3, 1.215%
12         0.3-0.5          2, 0.810%
13 Status code  total:              filtered:
14             200        247, 100.000%
15 Http method  total:              filtered:
16             GET        241, 97.571%
17            POST          6, 2.429%
18 RealIP       total:              filtered:
19       127.0.0.1        243, 98.381%
20   192.168.128.2          4, 1.619%
21 Uri total:
22     40 16.194%, /?service=Stationmessage.StationNotice.getNewStationNoticeCenter&userId=196311&isCount=1
23     20 8.097%, /?service=standard.options.getConfig&siteOptions=download_app
24     19 7.692%, /?service=user.users.getInfoById&userId=196311
25     11 4.453%, /?service=Live.anchor.followAnchorList&userId=196311&page=1&limit=20
26     11 4.453%, /?service=Live.Live.getNewHotList&userId=196311&page=1&limit=10&deviceNo=
27     11 4.453%, /?service=user.users.getUserInfoNumber&userId=196311
28     11 4.453%, /?service=Live.live.getNewFollowList&userId=196311&page=1&limit=10
29     10 4.049%, /?service=Live.Live.getNewFollowList&userId=196311&page=1&limit=2
30     8 3.239%, /?service=video.video.shareVideo&id=15
31     7 2.834%, /?service=Stationmessage.StationNotice.getNewStationNoticeCenter&userId=2&isCount=1
32     6 2.429%, /?service=Live.Live.getNewHotList&userId=0&page=1&limit=10&deviceNo=
33     6 2.429%, /?service=Live.video.getVideoLists&page=1&type=hot
34     6 2.429%, /?service=video.video.getVideoLists&uid=0&page=1
35     5 2.024%, /?service=Live.Live.getNewFollowList&userId=2&page=2&limit=2
36     5 2.024%, /?service=Live.Live.getNewFollowList&userId=2&page=1&limit=2
37     5 2.024%, /?service=Live.anchor.followAnchorList&userId=2&page=1&limit=20
38     5 2.024%, /?service=Live.live.getNewFollowList&userId=2&page=1&limit=10
39     4 1.619%, /?service=Shop.index.getIndexInfo
40     4 1.619%, /?service=Live.live.getNewFollowList&page=1&limit=10
41     4 1.619%, /?service=user.users.passLogin
42     3 1.215%, /?service=standard.verify.verifyMobileIsReg&mobile=15920122012
43     3 1.215%, /?service=video.video.getVideoLists&uid=0&page=1&type=1
44     -- 32 of 52 is hidden
45 Uri filtered:
46 Uri pattern total:
47     47 19.028%, /?service=Stationmessage.StationNotice.getNewStationNoticeCenter&userId=[0-9]&isCount=[0-9]
48     30 12.146%, /?service=Live.Live.getNewFollowList&userId=[0-9]&page=[0-9]&limit=[0-9]
49     20 8.097%, /?service=standard.options.getConfig&siteOptions=download_app
50     20 8.097%, /?service=Live.Live.getNewHotList&userId=[0-9]&page=[0-9]&limit=[0-9]&deviceNo=
51     20 8.097%, /?service=user.users.getInfoById&userId=[0-9]
52     16 6.478%, /?service=Live.live.getNewFollowList&userId=[0-9]&page=[0-9]&limit=[0-9]
53     16 6.478%, /?service=Live.anchor.followAnchorList&userId=[0-9]&page=[0-9]&limit=[0-9]
54     12 4.858%, /?service=user.users.getUserInfoNumber&userId=[0-9]
55     10 4.049%, /?service=video.video.getVideoLists&uid=[0-9]&page=[0-9]
56     9 3.644%, /?service=video.video.getVideoLists&uid=[0-9]&page=[0-9]&type=[0-9]
57     8 3.239%, /?service=video.video.shareVideo&id=[0-9]
58     6 2.429%, /?service=Live.video.getVideoLists&page=[0-9]&type=hot
59     5 2.024%, /?service=live.Anchor.starRankList&userId=[0-9]&page=[0-9]&type=[0-9]
60     4 1.619%, /?service=Live.live.getNewFollowList&page=[0-9]&limit=[0-9]
61     4 1.619%, /?service=user.users.passLogin
62     4 1.619%, /?service=standard.verify.verifyMobileIsReg&mobile=[0-9]
63     4 1.619%, /?service=user.users.accountLog&userId=[0-9]&page=[0-9]&limit=[0-9]
64     4 1.619%, /?service=Shop.index.getIndexInfo
65     2 0.810%, /?service=user.users.updateInfo
66     2 0.810%, /?service=user.users.newPersonalDetails&userId=[0-9]&selectId=[0-9]
67     2 0.810%, /?service=Live.Live.getLiveList&cateId=[0-9]&userId=[0-9]&page=[0-9]&limit=[0-9]
68     1 0.405%, /?service=video.video.getVideoLists&page=[0-9]
69     -- 3 of 23 is hidden
70 Uri pattern filtered:

更多用法参考:

[root@localhost ~]# ./xlog -h

 

posted @ 2017-06-02 10:57  andy_chan  阅读(515)  评论(0编辑  收藏  举报