0

0

Shell分析access

php中文网

php中文网

发布时间:2016-06-07 15:50:08

|

1895人浏览过

|

来源于php中文网

原创

#查看80端口的tcp连接 #netstat -tan | grep ESTABLISHED | grep :80 | wc -l 1 #当前WEB服务器中联接次数最多的ip地址: #netstat -ntu |awk '{print $5}' |sort | uniq -c| sort -n -r 231 ::ffff:127.0.0.1:8095 23 ::ffff:192.168.50.201:5432 2 ::ffff:1

#查看80端口的tcp连接

#netstat -tan | grep "ESTABLISHED" | grep ":80" | wc -l

1

#当前WEB服务器中联接次数最多的ip地址:

#netstat -ntu |awk '{print $5}' |sort | uniq -c| sort -n -r

231 ::ffff:127.0.0.1:8095

23 ::ffff:192.168.50.201:5432

2 ::ffff:192.168.50.203:80

1 servers)

1 ::ffff:192.168.50.56:43314

1 ::ffff:192.168.50.21:2996

1 ::ffff:192.168.50.21:2989

1 ::ffff:192.168.50.200:8060

1 ::ffff:192.168.50.12:1300

1 ::ffff:192.168.50.12:1299

1 ::ffff:192.168.50.12:1298

1 ::ffff:127.0.0.1:57933

1 Address

1 192.168.50.41:65310

1 192.168.50.41:64949

1 192.168.50.41:49653

#查看日志中访问次数最多的前10个IP

#cat access_log |cut -d ' ' -f 1 |sort |uniq -c | sort -nr | awk '{print $0 }' | head -n 10 |less

14085 121.207.252.122

13753 218.66.36.119

11069 220.162.237.6

1188 59.63.158.118

1025 ::1

728 220.231.141.28

655 114.80.126.139

397 117.25.55.100

374 222.76.112.211

348 120.6.214.70

#查看日志中出现100次以上的IP

#cat access_log |cut -d ' ' -f 1 |sort |uniq -c | awk '{if ($1 > 100) print $0}'|sort -nr |less

14085 121.207.252.122

13753 218.66.36.119

11069 220.162.237.6

1188 59.63.158.118

1025 ::1

728 220.231.141.28

655 114.80.126.139

397 117.25.55.100

374 222.76.112.211

348 120.6.214.70

252 58.211.82.150

252 159.226.126.21

206 121.204.57.94

192 59.61.111.58

186 218.85.73.40

145 221.231.139.30

134 121.14.148.220

123 222.246.128.220

122 61.147.123.46

119 121.204.105.58

107 116.9.75.237

105 118.123.5.173

#查看最近访问量最高的文件

#cat access_log |tail -10000|awk '{print $7}'|sort|uniq -c|sort -nr|less

8729 /server-status?auto

618 /

15 /favicon.ico

12 /manager/html

10 *

9 /top/icons.gif

8 /www.766.com/awstats.www.766.com.html

8 /awstatsicons/other/vv.png

8 /awstatsicons/other/vu.png

8 /awstatsicons/other/vp.png

8 /awstatsicons/other/vk.png

8 /awstatsicons/other/vh.png

8 /awstatsicons/other/hx.png

8 /awstatsicons/other/hp.png

8 /awstatsicons/other/hk.png

8 /awstatsicons/other/hh.png

8 /awstatsicons/other/he.png

8 /awstatsicons/other/awstats_logo6.png

8 /awstatsicons/os/win.png

8 /awstatsicons/os/unknown.png

8 /awstatsicons/os/unix.png

8 /awstatsicons/os/symbian.png

8 /awstatsicons/os/psp.png

#查看最近访问量最高的页面(.png)

#cat access_log |awk '{print $7}'|grep '.png'|sort|uniq -c|sort -nr |head -n 10

241 /awstatsicons/other/awstats_logo6.png

227 /awstatsicons/clock/hr12.png

226 /awstatsicons/other/vv.png

226 /awstatsicons/other/vu.png

226 /awstatsicons/other/vp.png

226 /awstatsicons/other/vk.png

226 /awstatsicons/other/vh.png

226 /awstatsicons/clock/hr9.png

226 /awstatsicons/clock/hr8.png

226 /awstatsicons/clock/hr7.png

#查看日志中访问超过100次的页面

#cat access_log | cut -d ' ' -f 7 | sort |uniq -c | awk '{if ($1 > 100) print $0}' | less

20107 /

1027 *

215 /awstatsicons/browser/chrome.png

215 /awstatsicons/browser/firefox.png

136 /awstatsicons/browser/mozilla.png

216 /awstatsicons/browser/msie.png

201 /awstatsicons/browser/netscape.png

123 /awstatsicons/browser/notavailable.png

214 /awstatsicons/browser/opera.png

215 /awstatsicons/browser/pdaphone.png

214 /awstatsicons/browser/safari.png

215 /awstatsicons/browser/unknown.png

226 /awstatsicons/clock/hr10.png

226 /awstatsicons/clock/hr11.png

227 /awstatsicons/clock/hr12.png

225 /awstatsicons/clock/hr1.png

226 /awstatsicons/clock/hr2.png

226 /awstatsicons/clock/hr3.png

226 /awstatsicons/clock/hr4.png

226 /awstatsicons/clock/hr5.png

226 /awstatsicons/clock/hr6.png

226 /awstatsicons/clock/hr7.png

226 /awstatsicons/clock/hr8.png

#access_log昨天一天的点击量(clicks);

cat access_log|grep '12/Nov/2009'|grep "******.jsp"|wc|awk '{print $1}'|uniq

0

#昨天访问网站的独立IP有多少;

cat access_log|grep '12/Aug/2009'|grep "******"|wc|awk '{print $1}'|uniq

194

#统计某url,一天的访问次数

#cat access_log|grep '12/Aug/2009'|grep '/images/index/e1.gif'|wc|awk '{print $1}'

2

#拉出前五天的访问次数最多的网页前20名清单;进行五天日志对比,找出排名靠前重复的网页,即可得出本周访问量最大的前几个网页;

#cat access_log|awk '{print $7}'|uniq -c |sort -n -r|head -20

10519 /

654 /manager/html

450 /manager/html

397 /

368 /manager/html

304 /

280 /manager/html

279 /

263 /manager/html

252 /manager/html

252 /manager/html

226 /

220 /

193 /

187 /

180 /

167 /

166 /

134 /

129 /

#从日志里查看该ip在干嘛:

#cat access_log | grep 218.66.36.119| awk '{print $1"/t"$7}' | sort | uniq -c | sort -nr | less

243 218.66.36.119 /

210 218.66.36.119 /awstatsicons/other/awstats_logo6.png

198 218.66.36.119 /awstatsicons/clock/hr12.png

197 218.66.36.119 /awstatsicons/other/vv.png

197 218.66.36.119 /awstatsicons/other/vu.png

197 218.66.36.119 /awstatsicons/other/vp.png

197 218.66.36.119 /awstatsicons/other/vk.png

197 218.66.36.119 /awstatsicons/other/vh.png

197 218.66.36.119 /awstatsicons/clock/hr9.png

197 218.66.36.119 /awstatsicons/clock/hr8.png

197 218.66.36.119 /awstatsicons/clock/hr7.png

197 218.66.36.119 /awstatsicons/clock/hr6.png

197 218.66.36.119 /awstatsicons/clock/hr5.png

197 218.66.36.119 /awstatsicons/clock/hr4.png

197 218.66.36.119 /awstatsicons/clock/hr3.png

197 218.66.36.119 /awstatsicons/clock/hr2.png

197 218.66.36.119 /awstatsicons/clock/hr1.png

197 218.66.36.119 /awstatsicons/clock/hr11.png

#列出传输时间超过 30 秒的文件

#cat access_log|awk ‘($NF > 30){print $7}’|sort -n|uniq -c|sort -nr|head -20

14058 /server-status?auto

8966 /

3955 /manager/html

1025 *

214 /www.766.com/awstats.www.766.com.html

211 /awstatsicons/other/awstats_logo6.png

199 /awstatsicons/clock/hr12.png

198 /awstatsicons/other/vv.png

198 /awstatsicons/other/vu.png

198 /awstatsicons/other/vp.png

198 /awstatsicons/other/vk.png

198 /awstatsicons/other/vh.png

198 /awstatsicons/clock/hr9.png

198 /awstatsicons/clock/hr8.png

198 /awstatsicons/clock/hr7.png

198 /awstatsicons/clock/hr6.png

198 /awstatsicons/clock/hr5.png

198 /awstatsicons/clock/hr4.png

198 /awstatsicons/clock/hr3.png

198 /awstatsicons/clock/hr2.png

#列出最最耗时的页面(超过60秒的)的以及对应页面发生次数

#cat access_log |awk ‘($NF > 60 && $7~//.php/){print $7}’|sort -n|uniq -c|sort -nr|head -100

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
Golang 生态工具与框架:扩展开发能力
Golang 生态工具与框架:扩展开发能力

《Golang 生态工具与框架》系统梳理 Go 语言在实际工程中的主流工具链与框架选型思路,涵盖 Web 框架、RPC 通信、依赖管理、测试工具、代码生成与项目结构设计等内容。通过真实项目场景解析不同工具的适用边界与组合方式,帮助开发者构建高效、可维护的 Go 工程体系,并提升团队协作与交付效率。

1

2026.02.24

Golang 性能优化专题:提升应用效率
Golang 性能优化专题:提升应用效率

《Golang 性能优化专题》聚焦 Go 应用在高并发与大规模服务中的性能问题,从 profiling、内存分配、Goroutine 调度、GC 机制到 I/O 与锁竞争逐层分析。结合真实案例讲解定位瓶颈的方法与优化策略,帮助开发者建立系统化性能调优思维,在保证代码可维护性的同时显著提升服务吞吐与稳定性。

2

2026.02.24

Golang 面试题精选:高频问题与解答
Golang 面试题精选:高频问题与解答

Golang 面试题精选》系统整理企业常见 Go 技术面试问题,覆盖语言基础、并发模型、内存与调度机制、网络编程、工程实践与性能优化等核心知识点。每道题不仅给出答案,还拆解背后的设计原理与考察思路,帮助读者建立完整知识结构,在面试与实际开发中都能更从容应对复杂问题。

1

2026.02.24

Golang 运行与部署实战:从本地到云端
Golang 运行与部署实战:从本地到云端

《Golang 运行与部署实战》围绕 Go 应用从开发完成到稳定上线的完整流程展开,系统讲解编译构建、环境配置、日志与配置管理、容器化部署以及常见运维问题处理。结合真实项目场景,拆解自动化构建与持续部署思路,帮助开发者建立可靠的发布流程,提升服务稳定性与可维护性。

3

2026.02.24

Golang 疑难杂症解决指南:常见问题排查与优化
Golang 疑难杂症解决指南:常见问题排查与优化

《Golang 疑难杂症解决指南》聚焦开发过程中常见却棘手的问题,从并发模型、内存管理、性能瓶颈到工程化实践逐步拆解。通过真实案例与调试思路,帮助开发者定位问题根因,建立系统化排查方法。不只给出答案,更强调分析路径与工具使用,让你在复杂 Go 项目中具备持续解决问题的能力。

1

2026.02.24

Golang 入门学习路线:从零基础到上手开发
Golang 入门学习路线:从零基础到上手开发

Golang 入门路线涵盖从零到上手的核心路径:首先打牢基础语法与切片等底层机制;随后攻克 Go 的灵魂——接口设计与 Goroutine 并发模型;接着通过 Gin 框架与 GORM 深入 Web 开发实战;最后在微服务与云原生工具开发中进阶,旨在培养具备高性能并发处理能力的后端工程师。

0

2026.02.24

中国研究生招生信息网官方网站入口 研招网网页版在线入口
中国研究生招生信息网官方网站入口 研招网网页版在线入口

中国研究生招生信息网入口(https://yz.chsi.com.cn) 此网站是研究生报名入口的唯一官方网站

95

2026.02.24

苹果官网入口与在线访问指南_中国站点快速直达与iPhone查看方法
苹果官网入口与在线访问指南_中国站点快速直达与iPhone查看方法

本专题汇总苹果官网最新可用入口及中国站点访问方式,涵盖官网直达链接、iPhone官方页面查看方法与常见访问说明,帮助用户快速进入苹果官方网站,便捷了解产品信息与官方服务。

14

2026.02.24

Asianfanfics官网入口与访问指南_AFF官方平台最新登录地址
Asianfanfics官网入口与访问指南_AFF官方平台最新登录地址

本专题系统整理Asianfanfics(AFF)官方网站最新可用入口,涵盖官方平台最新直达地址、官网登录方式及中文访问指引,帮助用户快速、安全地进入AFF平台浏览与使用相关内容。

15

2026.02.24

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
尚观shell视频教程
尚观shell视频教程

共8课时 | 1.7万人学习

Linux开发篇视频教程
Linux开发篇视频教程

共18课时 | 4.1万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号