ngxtop is a python-based program that can be installed on Python. ngxtop access to real-time analytic nginx logs,
And the result (useful indicator nginx server) to the terminal.
The main function
-
Current valid request
-
The total request count summary
-
The total number of requests provided by the status code (2xx, 3xx, 4xx, 5xx)
-
Average number of bytes transmitted
-
Top Remote Address
Not only can real-time monitoring Nginx access logs can also troubleshoot collation of previous log.
Ngxtop installed on Linux
First, you need to install the PIP (Python package management system)
-
Log in to your server using the root credentials
-
Enable EPEL repository by installing the following package
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm
rpm -ivh epel-release-7-6.noarch.rpm
然后执行以下命令安装pip
yum install python-pip
最后使用下面安装ngxtop
pip install ngxtop
ngxtop uses detailed
usage:
ngxtop [Option]
ngxtop [Option] (Print | Top | AVG | SUM) <var>
ngxtop info
Options:
ngxtop practice
1. Use ngxtop request count command to view a summary of the URI request, the request status code number.
$ ngxtop
2. Check the top client IP
See who issued a large number of requests to your server Nginx
ngxtop top remote_addr
3 only shows the HTTP request 404
ngxtop -i'status> = 404'
4. Analysis access.log
ngxtop -l /path/access.log
5. Parse the Apache offline access.log
ngxtop -f common -l /path/access.log
Also you can use a variety of combinations to filter access.log to get useful data
https://github.com/lebinh/ngxtop