关于apache access log 统计的那些事儿
cat access.log-20090904 |awk '{print $3}'|sort|uniq -c|sort -rn|wc -l
详解:下面是一个例子:
cat 是读取这个文件。
1147753394.079 2 220.139.141.61 TCP_DENIED/403 1354 CONNECT 222.124.24.93:25 - NONE/- text/html
1147753395.652 0 61.228.130.169 TCP_DENIED/403 1352 CONNECT 203.84.195.1:25 - NONE/- text/html
1147753395.754 0 61.228.135.187 TCP_DENIED/403 1350 CONNECT 203.86.1.30:25 - NONE/- text/html
1147753398.042 3 61.228.131.15 TCP_DENIED/403 1354 CONNECT 81.169.162.54:25 - NONE/- text/html
awk '{print $3}' 是apache log的第三个字段
220.139.141.61
61.228.130.169
[root@localhost~]# cat access.log | awk '{print $3}'
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.99
61.228.130.187
sort是排序,
[root@localhost~]# cat access.log | awk '{print $3}'|sort
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
61.228.134.106
uniq -c 打印每一重复行出现的次数。
[root@localhost~]# cat access.log | awk '{print $3}'|sort|uniq -c
6 220.139.141.61
6 61.228.130.169
12 61.228.130.187
6 61.228.131.15
sort -rn 对排序求逆,n为域号,使用此域号开始分类。
[root@localhost~]# cat access.log | awk '{print $3}'|sort|uniq -c|sort -rn
24 61.228.134.106
12 61.228.130.187
6 61.228.135.187
6 61.228.134.99
6 61.228.131.15
6 61.228.130.169
6 220.139.141.61
wc -l 统计行数的
[root@localhost~]# cat access.log | awk '{print $3}'|sort|uniq -c|sort -rn|wc -l
7
关于apache access log 统计的那些事儿的更多相关文章
- PHP Apache Access Log 分析工具 拆分字段成CSV文件并插入Mysql数据库分析
现在需要分析访问日志,怎么办? 比如分析D:\Servers\Apache2.2\logs\access2014-05-22.log http://my.oschina.net/cart/针对这个问题 ...
- Apache的Access.log分析总结
Apache的Access.log分析总结 #查看80端口的tcp连接 #netstat -tan | grep "ESTABLISHED" | grep ":80&q ...
- netstat--查看服务器[有效]连接数--统计端口并发数--access.log分析
简介 Netstat 命令用于显示各种网络相关信息,如网络连接,路由表,接口状态 (Interface Statistics),masquerade 连接,多播成员 (Multicast Member ...
- 【转载】netstat--查看服务器[有效]连接数--统计端口并发数--access.log分析
简介 Netstat 命令用于显示各种网络相关信息,如网络连接,路由表,接口状态 (Interface Statistics),masquerade 连接,多播成员 (Multicast Member ...
- shell定时统计Nginx下access.log的PV并发送给API保存到数据库
1,统计PV和IP 统计当天的PV(Page View) cat access.log | sed -n /`date "+%d\/%b\/%Y"`/p |wc -l 统计某一天的 ...
- 通过Nginx,Tomcat访问日志(access log)记录请求耗时
一.Nginx通过$upstream_response_time $request_time统计请求和后台服务响应时间 nginx.conf使用配置方式: log_format main '$remo ...
- JMeter学习(三十一)Access Log Sampler
前提: 在tomcat\conf\server.xml默认情况下,会有一段代码: <Valve className="org.apache.catalina.valves.Access ...
- resin access.log format配置详解
The access log formatting variables follow the Apache variables: %b result content length %D tim ...
- Web学习-apache视图log刊物
视图apache刊物 apache日志位置 不同的系统位置不同. widnows 假如是windows的话,xampp下应该是都存在的,直接去找apache的folder/log/access.log ...
随机推荐
- 编写hadoop程序并打成jar包上传到hadoop集群运行
准备工作: 1. hadoop集群(我用的是hadoop-2.7.3版本),这里hadoop有两种:1是编译好的hadoop-2.7.3:2是源代码hadoop-2.7.3-src: 2. 自己的机器 ...
- 任务29:自己动手构建RequestDelegate管道
cmd创建一个控制台应用程序 dotnet new console --name MyPipeline 用VSCode打开这个项目 新建类RequestDelegate.cs的类文件复制Program ...
- 斯坦福CS231n—深度学习与计算机视觉----学习笔记 课时2
课时2 计算机视觉历史回顾与介绍中 1966年是计算机视觉的诞生年. 视觉处理流程的第一步,是对简单的形状结构处理,边缘排列. 边缘决定了结构. David Marr写了一本非常有影响力的书,视觉是分 ...
- (水题)洛谷 - P1014 - Cantor表
https://www.luogu.org/problemnew/show/P1014 很显然同一对角线的和是相等的.我们求出前缀和然后二分. 最后注意奇偶的顺序是相反的. #include<b ...
- poj 2492 A Bug's Life【带权并查集】
就是给一个无向图判是否有奇环 用带权并查集来做,边权1表示连接的两个节点异性,否则同性,在%2意义下进行加法运算即可,最后判相同的时候也要%2,因为可能有负数 #include<iostream ...
- Python 字符串太长分行写
原文:https://blog.csdn.net/peng__dada/article/details/79138135 #第一种:三个单引号 print '''我是一个程序员 我刚开始学 ...
- macOS 将【允许从以下位置下载的应用】设置为:任意来源
用管理员帐号进入Terminal: 1) 输入:sudo spctl --master-disable ,回车: 2) 重新进入该设置页面即可看到已生效:
- icomoon字体使用
如何灵活利用免费开源图标字体-IcoMoon篇 by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/w ...
- [Usaco2012 Jan]Video Game
Description Bessie is playing a video game! In the game, the three letters 'A', 'B', and 'C' are the ...
- AtCoder Grand Contest 016 B - Colorful Hats
题目传送门:https://agc016.contest.atcoder.jp/tasks/agc016_b 题目大意: 有\(N\)只猫,每只猫头上带着一个帽子,帽子有颜色,现在告诉你每只猫能看到的 ...