Using Ngxtop to realize nginx real-time access data statistics _nginx

Source: Internet
Author: User

For Nginx real-time Access data statistics, Ngxtop can be used to monitor Web server access. Ngxtop allows you to parse the access log of NGINX in real time and output useful information similar to top.

Ngxtop is a Python script installation package that requires Python support.

For Python's package and library files we generally prefer PIP management, which is not installed to:

wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py #安装pip python package management tool
PIP Install Ngxtop #下载安装ngxtop

Use:

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

Display the most requested IP and request

Ngxtop-t 1-l/var/log/nginx/access.log Top REMOTE_ADDR Request

Use Help:

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&gt,--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
           Written to the access log.
  Use this flag to the "ngxtop to" process the current content of the access log instead. -T <seconds>,--interval <seconds> 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 in output for default query [Default:count]-N <number&gt ;,--limit <number> limit the number of records included in-for-top command [default:10]-a <exP> ...,--a <exp> add exp (must be aggregation exp:sum, AVG, MIN, max, etc.) into Output-v,--verbose Mor
  e 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&gt,--filter <filter-expression> filter in, records satisfied given expression are Proces
  Sed.
 -P <filter-expression&gt,--pre-filter <filter-expression> in-filter expression to check in pre-parsing phase.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.