访问日志名:localhost_access_log.2019-01-29.txt

日志格式示例

192.168.0.1 - - [/Nov/::: +] "GET /images/rand HTTP/1.0"   "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)" "sso.test.com" 27.17.66.35
192.168.3.7 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)" "sso.test.com" 113.0.64.155
192.168.0.51 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)" "sso.test.com" 183.8.202.141
192.168.1.1 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)" "sso.test.com" 183.8.202.141
192.168.1.8 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)" "sso.test.com" 183.8.202.141
192.168.2.1 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)" "sso.test.com" 27.17.66.35
192.168.3.7 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)" "sso.test.com" 113.0.64.155
192.168.2.51 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)" "sso.test.com" 183.8.202.141
192.168.0.1 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)" "sso.test.com" 183.8.202.141
192.168.1.8 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)" "sso.test.com" 183.8.202.141
192.168.0.1 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)" "sso.test.com" 27.17.66.35
192.168.3.7 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)" "sso.test.com" 113.0.64.155
192.168.2.51 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)" "sso.test.com" 183.8.202.141
192.168.5.1 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)" "sso.test.com" 183.8.202.141
192.168.6.8 - - [/Nov/::: +] "GET /images/rand HTTP/1.0" "https://www.test.com/index.shtml" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)" "sso.test.com" 183.8.202.141

访问前5的IP以及对应IP访问次数降序排列(因IP在日志中的第一列,所以取$1)

cat localhost_access_log.--.txt|awk '{print $1}'|sort |uniq -c|sort -nr|head -

运行结果

       192.168.3.7
192.168.0.1
192.168.2.51
192.168.1.8
192.168.6.8

linux 查看Apache Tomcat日志访问IP前10的更多相关文章

  1. Shell 命令行统计 apache 网站日志访问IP以及IP归属地

    Shell 命令行统计 apache 网站日志访问IP以及IP归属地 我的一个站点用 apache 服务跑着,积攒了很多的日志.我想用 shell 看看有哪些人访问过我的站点,并且他来自哪里. 因为日 ...

  2. 一句话输出NGINX日志访问IP前十位排行

    AWK的数组字段自增加,然后取值的方法,要记得哟. 还有,SORT指定列排行,也常用的.

  3. linux分析apache日志获取最多访问的前10个IP

    apache日志分析可以获得很多有用的信息,现在来试试最基本的,获取最多访问的前10个IP地址及访问次数. 既然是统计,那么awk是必不可少的,好用而高效. 命令如下: awk '{a[$1] += ...

  4. Linux分析日志获取最多访问的前10个IP

    原文地址:http://xuqq999.blog.51cto.com/3357083/774714 apache日志分析可以获得很多有用的信息,现在来试试最基本的,获取最多访问的前10个IP地址及访问 ...

  5. 查看apache当前并发访问数和进程数

    1.查看apache当前并发访问数: netstat -an | grep ESTABLISHED | wc -l 对比httpd.conf中MaxClients的数字差距多少. 2.查看有多少个进程 ...

  6. centos linux服务器apache+mysql环境访问慢优化方法

    查找软件安装目录:find / -name 软件名称 一.优化apache配置增加MaxClients的值 默认情况下,2.0及以上apache版本MaxClients的值为256,对于中大型应用访问 ...

  7. linux下重启tomcat,日志查看

    版权声明:本文为楼主原创文章,未经楼主允许不得转载,如要转载请注明来源. 一:关闭tomcat 1.使用cd命令以及常用的tab补全命令进入到tomcat bin所在的目录(可以不用到此目录也行,楼主 ...

  8. Linux中Apache+Tomcat+JK实现负载均衡和群集的完整过程

    人原创,一个字一个字地码的,尊重版权,转载请注明出处! http://blog.csdn.net/chaijunkun/article/details/6987443 最近在开发的项目需要承受很高的并 ...

  9. Linux查看大文件日志

    Linux 查看大日志文件1.使用 less 命令 less filename 但是使用上述命令的坏处是,默认打开的位置在第一行,并且当切换到实时滚动模式(按 F ,实现效果类似 tail -f 效果 ...

随机推荐

  1. app内嵌 h5页面 再滑动的时候 触发击穿底下的一些touchstart事件

    我们的目的是再滑动的时候 不要触发到touchstart事件. // 再滑动的时候无法点开视频 var is_scroll_start,is_scroll_end; $(window).on({ 't ...

  2. PHP将json或对象转成数组

    今天老大突然给了我一个小任务,给我一个txt文件,里边是很多的json字串,要求将这些字串转换成php中的数组: 于是开足火力,用了将进5分钟的时间完成了任务,代码如下: $jsonStr = fil ...

  3. python opencv:使用鼠标当做画笔

    鼠标事件 import cv2 events=[i for i in dir(cv2) if 'EVENT'in i] print events 双击画圆圈 import cv2 import num ...

  4. ML 是什么意思?

    ML到底是什么意思? 1.(ML)machine language机器语言,makeup language.参见:ML语言: 通用的函数式编程语言. 2.(ML)machine learning,人工 ...

  5. Spring Boot 集成 Swagger2 教程

    上篇讲过 Spring Boot RESTful api ,这篇简单介绍下 SwaggerUI 在 Spring Boot 中的应用. Swagger 是一个规范和完整的框架,用于生成.描述.调用和可 ...

  6. 杭电 1203 I NEED A OFFER!

    I NEED A OFFER! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  7. Python数据分析之Numpy操作大全

    从头到尾都是手码的,文中的所有示例也都是在Pycharm中运行过的,自己整理笔记的最大好处在于可以按照自己的思路来构建矿建,等到将来在需要的时候能够以最快的速度看懂并应用=_= 注:为方便表述,本章设 ...

  8. @ResponseBody是如何起作用的

    前言 最近参与的项目中,接口中返回的日期格式不对,发现项目中配置了fastjson作为spring的数据转换器,于是使用了fastjson的字段格式化转换注解 发现不起作用.这让我很疑惑,然后在fas ...

  9. 设计模式六大原则——开放封闭原则(OCP)

    什么是开闭原则? 定义:是说软件实体(类.模块.函数等等)应该可以扩展,但是不可修改. 开闭原则主要体现在两个方面: 1.对扩展开放,意味着有新的需求或变化时,可以对现有代码进行扩展,以适应新的情况. ...

  10. knockout 简单使用

    定义: var QcViewModel = function () { var self = this; self.name = ko.observable(); self.qty = ko.obse ...