访问日志名: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. python正则表达式中括号的作用,形如 "(\w+)\s+\w+"

    先看一个例子: import re string="abcdefg acbdgef abcdgfe cadbgfe" #带括号与不带括号的区别 regex=re.compile(& ...

  2. excel 练习玩具统计项目组excel日报

    import xlrd import xlwt import os,time import json from xlrd import xldate_as_tuple from datetime im ...

  3. uniGUI之UniPopupMenu和右键菜单(27)

    0]MainModule的BrowserOptions.boDisableMouseRightClick设置为Trure; 1]控件的OnCellContextClick的事件 procedure T ...

  4. linu后台执行py文件和关闭的后台py文件

    后台执行py nohup python xxx.py 关闭后台执行py 查看进程pid ps -aux|grep main.py 根据pid关闭关闭进程 kill -9 (pid)

  5. Python中注释与声明

    Python中注释的写法 #:使用井号进行单行注释 Python中貌似没有提供多行注释,不过我们可以利用三引号的多行字符串来进行多行注释 """ 多行注释内容 多行注释内 ...

  6. SPOJ QTREE Query on a Tree【树链剖分模板题】

    树链剖分,线段树维护~ #include <cstdio> #include <cstring> #include <iostream> #include < ...

  7. CSS的精灵技术

  8. css属性书写顺序(重点)

  9. 802.1X基本配置

    基本的802.1X部署工作包括以下4步:    1. 为Cisco Catalyst交换机配置802.1X认证方    2. 为交换机配置访客VLAN或者受限VLAN,并调整802.1X定时器(可选) ...

  10. WLC-Right to Use Licensing

    1.RTU的介绍 RTU licensing是没有和UDI(unique device identifier)或SN绑定的一种模型.在你接受了最终用户许可协议(EULA)后,使用RTU license ...