nginx实时访问数据统计:ngxtop,实时监控web server的访问情况 。ngxtop 允许你对 NGINX 的访问日志 (access log) 进行实时解析, 并输出类似 top 的有用信息。 ngxtop 是 python 脚本安装包,需要python支持。 对于python的包和库文件我们一般喜欢pip管理,没有安装的可以:
显示请求最多的ip和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.
项目地址:https://github.com/lebinh/ngxtop (责任编辑:IT) |