apache和其他web服务器的“top”,以及强大的日志映射
wtop的Python项目详细描述
概述
运行统计的wtop
wtop就像web服务器的“top”。有多少个搜索或注册 每秒发生一次静态的响应时间直方图是多少 文件夹?wtop让你一目了然。
用于web服务器日志分析的logrep
logrep是一个强大的命令行程序,用于特殊分析和筛选。 抽查页面性能、错误、汇总统计等。
抽查页面性能、错误、汇总统计等:
$ logrep -o 'status,count(*),avg(msec),min(msec),max(msec)' access.log 200 4196 244.58 3 589 302 5 79.75 17 42 404 1 9.00 9 9 304 798 158.76 0 694
了解机器人交通量在白天是如何升降的:
$ logrep --robots-only --output \ 'botname,month,day,count(*),avg(msec),dev(msec)' --sort '30:1,2,3:asc' Googlebot 7 20 1090 1045.97 1.65 Googlebot 7 21 771 3082.58 2.08 Googlebot 7 22 1177 1278.14 1.89 Googlebot 7 23 1134 1841.48 2.59 Googlebot 7 24 1057 1636.69 2.81 Googlebot 7 25 536 1210.78 2.10 ...
查询特定字符串和条件:
$ logrep -f "status=200,bytes>1000,msec<1000,url~Paris" \ -o ts,msec,bytes,url 1213574430 125 47396 /Paris-Hilton 1213574892 126 47391 /Paris-Hilton 1213579556 393 23028 /Diane-Parish 1213582392 402 19757 /Paris-Kanellakis 1213582651 530 23751 /Paris-Bennett 1213584996 366 19295 /Tristan-Paris 1213586358 114 47295 /Paris-Hilton 1213587075 227 22424 /Steve-Pariso ...
有关其他示例,请参见CookbookLogrep - wtop wiki。
安装
这将把logrep和wtop放在您的可执行路径中,并删除 默认设置为适合安装的位置 (使用适合平台的路径分隔符)。它搜索 按以下顺序配置:
- virtualenv+/etc/wtop.cfg
- pythonuserbase+/etc/wtop.cfg
- 用户库+/etc/wtop.cfg
- python lib+/etc/wtop.cfg
- /etc/wtop.cfg
调用logrep-d查看它使用的位置。
wtop/logrep需要python 2.6或更高版本。
debian、ubuntu、windows等
测试快速启动
将目录更改为存储库(与本自述文件所在的目录相同 居住)
安装虚拟环境:
mkvirtualenv -a . -r tests/requirements.txt wtop_test
如果安装需求错误,请更新pip
pip install --upgrade pip
安装要求:
pip install -r tests/requirements.txt
运行pytest:
py.test
为了测试其他python版本,创建虚拟 使用解释程序的环境,而不是使用virtualenv 已安装,例如,对于非默认python3:
mkvirtualenv -a $(pwd) -p $(which python3) -r tests/requirements.txt wtop_test3