蝙蝠岛资源网 Design By www.hbtsch.com

对于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.

标签:
ngxtop,nginx,实时访问,数据统计

蝙蝠岛资源网 Design By www.hbtsch.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
蝙蝠岛资源网 Design By www.hbtsch.com

评论“采用ngxtop实现nginx实时访问数据统计”

暂无采用ngxtop实现nginx实时访问数据统计的评论...

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?