一条语句查看web日志排名前十的IP/URL页面及总数

查看 Nginx web 访问日志访问量前十的ip 以及访问的网站页面地址 ,可以分析网站哪些页面受欢迎,以及访问量大的ip在干什么!
标签: <无>

代码片段(3)[全屏查看所有代码]

1. [代码][Shell/批处理]代码     

01 awk '{print $1}' access.log | sort uniq -c | sort -nr | head -n 10
02  
03 #结果
04  391942 211.**.151.218
05  269168 218.**.103.140
06  142282 112.**.20.133
07  105460 112.**.25.241
08   96016 119.**.155.137
09   89926 112.**.31.16
10   83113 218.**.200.19
11   79975 112.**.28.11
12   79890 119.**.156.14
13   72041 124.**.110.72

2. [代码][Shell/批处理]代码     

01 #如果想查看某一天的
02 cat access.log | grep "07/Nov/2013" awk '{print $1}' |  uniq -c | sort -nr | head -n 10
03 #结果
04    3452 60.**.235.88
05    2297 119.**.195.228
06    2258 113.**.145.91
07    1221 123.**.187.223
08     905 211.**.82.175
09     899 117.**.5.207
10     888 112.**.24.202
11     787 110.**.139.183
12     576 143.**.5.44
13     574 125.**.18.21

3. [代码][Shell/批处理]代码     

01 awk '{print $11}' access.log | sort uniq -c | sort -nr | head -n 10
02  
03 #结果
04  
05 1420617 "http://***.com/forum.php"
06  844547 "http://***.com/?fromuid=1180"
07  760045 "http://www.***.com/"
08  697515 "http://www.***.com/forum.php"
09  436309 "http://www.***.com/?fromuid=1080"
10  279609 "http://www.***.com/?fromuid=21"
11  172784 "http://www.***.com/?fromuid=2123"
12  108563 "http://www.***.com/?fromuid=1090"
13   86906 "http://www.***.com/plugin.php?id=sanree_brand:sanree_brand"
14   80661 "http://www.***.com/plugin.php?id=sanree_brand_goods:sanree_brand_goods"

posted on 2014-06-19 12:07  分布式编程  阅读(223)  评论(0编辑  收藏  举报

导航