Apache 网站日志分析
1.获得访问前 10 位的 ip 地址
[root@apache ~]# cat access_log |awk '{print $1}'|sort|uniq -c|sort -nr|head -10
2.访问次数最多的文件或页面,取前 20
cat access.log|awk ‘{print $11}’|sort|uniq -c|sort -nr|head -20
3.列出传输最大的几个 exe 文件
cat access.log |awk ‘($7~/\.exe/){print $10 ” ” $1 ” ” $4 ” ” $7}’|sort -nr|head -20
4. 列出输出大于 200000byte(约 200kb)的 exe 文件以及对应文件发生次 数
cat access.log |awk ‘($10 > 200000 && $7~/\.exe/){print $7}’|sort -n|uniq -c|sort -nr|head -100
5. 如果日志最后一列记录的是页面文件传输时间,则有列出到客户端 最耗时的页面
cat access.log |awk ‘($7~/\.php/){print $NF ” ” $1 ” ” $4 ” ” $7}’|sort -nr|head -100
6. 列出最最耗时的页面(超过 60 秒的)的以及对应页面发生次数
cat access.log |awk ‘($NF > 60 && $7~/\.php/){print $7}’|sort -n|uniq -c|sort -nr|head -100
7. 列出传输时间超过 30 秒的文件
cat access.log |awk ‘($NF > 30){print $7}’|sort -n|uniq -c|sort -nr|head -20
8. 统计网站流量(G)
cat access.log |awk ‘{sum+=$10} END {print sum/1024/1024/1024}’
9. 统计 404 的连接
awk ‘($9 ~/404/)’ access.log | awk ‘{print $9,$7}’ | sort
10. 统计 http status.
cat access.log |awk ‘{counts[$(9)]+=1}; END {for(code in counts) print code, counts[code]}'
cat access.log |awk '{print $9}'|sort|uniq -c|sort -rn
11. 蜘蛛分析
查看是哪些蜘蛛在抓取内容。
/usr/sbin/tcpdump -i eth0 -l -s 0 -w - dst port 80 | strings | grep -i user-agent | grep -i -E
'bot|crawler|slurp|spider'
Webalizer 日志分析程序
[root@Apache-Server tools]# yum install -y webalizer
[root@Apache-Server tools]# less /etc/webalizer.conf
相关文章
- org.apache.hadoop.fs.FSError: java.io.IOException: 设备上没有空间 at org.apache.hadoop.fs.RawLocalFileSyste
- Filebeat+Logstash+ElasticSearch+Kibana搭建Apache访问日志解析平台
- 《Apache Flink 官方文档》前言
- Linux有问必答:Linux上Apache错误日志的位置在哪里?
- Apache开启状态查看页面(原创贴-转载请注明出处)
- 彻底解决Could not transfer artifact org.apache.maven.plugins问题
- linux Apache 日志配置
- Apache Flink SQL概览
- Apache JServ protocol服务 怎么关闭?
- 轻量应用服务器如何通过修改apache配置文件实现非https的访问多域名到不同子目录程序?
- 【大数据】Spark开源REST服务--Apache Livy的安装和使用
- 10 Powerful Apache Modules--reference