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>,--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> ;,--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>,--filter <filter-expression> filter in, records satisfied given expression are Proces
Sed.
-P <filter-expression>,--pre-filter <filter-expression> in-filter expression to check in pre-parsing phase.