发布于 2016-02-08 11:17:36 | 370 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Nginx中文文档,程序狗速度看过来!

Nginx WEB服务器

Nginx 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。


这篇文章主要介绍了采用ngxtop实现nginx实时访问数据统计,需要的朋友可以参考下

对于nginx的实时访问数据统计可采用ngxtop实现监控web server的访问情况 。ngxtop 允许你对 NGINX 的访问日志 (access log) 进行实时解析, 并输出类似 top 的有用信息。

ngxtop 是 python 脚本安装包,需要python支持。

对于python的包和库文件我们一般喜欢pip管理,没有安装的可以:


wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py #安装pip python包管理工具
pip install ngxtop #下载安装ngxtop

使用:


ngxtop -l /usr/local/nginx/logs/access.log

显示请求最多的ip和request


ngxtop -t 1 -l /var/log/nginx/access.log top remote_addr request

使用帮助:


Usage:
  ngxtop [options]
  ngxtop [options] (print|top|avg|sum) <var>
  ngxtop info

Options:
  -l <file>, --access-log <file> access log file to parse.
  -f <format>, --log-format <format> log format as specify in log_format directive.
  --no-follow ngxtop default behavior is to ignore current lines in log
           and only watch for new lines as they are written to the access log.
           Use this flag to tell ngxtop to process the current content of the access log instead.
  -t <seconds>, --interval <seconds> report interval when running in follow mode [default: 2.0]
  -g <var>, --group-by <var> group by variable [default: request_path]
  -w <var>, --having <expr> having clause [default: 1]
  -o <var>, --order-by <var> order of output for default query [default: count]
  -n <number>, --limit <number> limit the number of records included in report for top command [default: 10]
  -a <exp> ..., --a <exp> ... add exp (must be aggregation exp: sum, avg, min, max, etc.) into output
  -v, --verbose more verbose output
  -d, --debug print every line and parsed record
  -h, --help print this help message.
  --version print version information.
  Advanced / experimental options:
  -c <file>, --config <file> allow ngxtop to parse nginx config file for log format and location.
  -i <filter-expression>, --filter <filter-expression> filter in, records satisfied given expression are processed.
  -p <filter-expression>, --pre-filter <filter-expression> in-filter expression to check in pre-parsing phase.



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务