python小程序:查找nginx日志文件的ip点击率并排序
2016-11-10 13:40
776 查看
def nginxIpCounter(nginxFile): ipCounter = { } with open(nginxFile) as f: for line in f: ip = line.split(" ",1)[0] if 6<=len(ip) <= 15: ipCounter[ip] = ipCounter.get(ip,0) + 1 return ipCounter nginxIp = { } nginxIpBySort = { } nginxIp = nginxIpCounter("/root/nginx_ip.test") nginxIpBySort = sorted(nginxIp.iteritems(),key = lambda d:d[1] ,reverse = True) for i,j in nginxIpBySort: print "%s => %d"%(i,j)
相关文章推荐
- 使用python找出nginx访问日志中访问次数最多的10个ip排序生成网页
- python---实战日志文件中查找特定字段,文件操作读写、排序、替换、列表、集合
- 本文以python实现了一个日志文件中ip提取与统计程序
- 使用python 分析统计nginx访问日志ip次数并且排序
- python实现分析apache和nginx日志文件并输出访客ip列表的方法
- python 从远程服务器下载日志文件的程序
- python分析nginx日志根据共性url屏蔽ip
- 无core文件根据系统日志查找 程序core信息
- 给Asus WL500G Deluxe无线路由器日志文件添加IP地址地理位置信息的Python小程序
- 【python学习】日志文件里IP访问最多的3个
- Python解析nginx日志文件
- 把以下IP存入一个txt文件,编写程序把这些IP按数值大小,从小到达排序并打印出来。 61.54.231.245 61.54.231.9 61.54.231.246 61.54.231.48
- 分析nginx大日志文件,python多线程必备! .
- python分析nginx日志的ip(中篇二)
- Nginx 日志文件 访问IP统计
- 虚拟主机ip配置,nginx.conf文件配置及日志文件切割
- python脚本实现统计日志文件中的ip访问次数代码分享
- python分析nginx日志的ip(上篇)
- python 分析 nginx 日志 ip 并存入sqlite 数据库
- Python基于nginx访问日志并统计IP访问量