访问日志access.log统计ip和每个地址访问的次数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了访问日志access.log统计ip和每个地址访问的次数相关的知识,希望对你有一定的参考价值。
access.log:
192.168.1.247 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.246 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.245 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.243 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.247 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.247 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.245 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.246 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.246 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.247 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.245 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.245 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.246 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.243 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
192.168.1.247 - - [02/[ul/2015:23:44:59 [0800] "GET /[HTTP/1.1 200 19"
答案:
[[email protected] shell]$ awk ‘{print $1}‘ access.log |sort -n|uniq -c|sort -rn|head
5 192.168.1.247
4 192.168.1.246
4 192.168.1.245
2 192.168.1.243
本文出自 “linux” 博客,转载请与作者联系!
以上是关于访问日志access.log统计ip和每个地址访问的次数的主要内容,如果未能解决你的问题,请参考以下文章