Python-based ngxtop installation, monitoring nginx and usage analysis

Ngxtop is a tool developed in python to monitor nginx access logs.

It dynamically views the most visited requests in real time.

Install ngxtop on centos

Yum install python-pip

Pip install ngxtop

Use ngxtop -h to view its options, several of which have the following meanings:

1)-l specifies the access log

2) -f specifies the log format

3) --no-follow only processes log files that have been written, instead of processing newly added logs in real time

4) -c specifies the nginx.conf path

5) -n specifies the display line number

Description of content.

Ngxtop specific usage

1) $ ngxtop

If you get an error: Error: Access log file or format was not set and nginx config file cannot be detected. Perhaps nginx is not in your PATH?

This is because ngxtop can't find the executable file nginx, the solution is

Ln -s /usr/local/nginx/sbin/nginx /sbin/nginx

2) $ ngxtop -c /usr/local/nginx/conf/nginx.conf -n 20 //

Specify nginx.conf, display 20 lines, the result is as shown

Python-based ngxtop installation, monitoring nginx and usage analysis

3) $ ngxtop -c /usr/local/nginx/conf/nginx.conf print request http_user_agent remote_addr //

Use print to print the specified variable

4) $ ssh remote tail -f /var/log/apache2/access.log | ngxtop -f common //

Analyze logs from remote machines

Smart Phone Holder For Car Vent

Smart Phone Holder For Car Vent,Air Vent Iphone Mount,Air Vent Phone Holder,Air Vent Cell Phone Pouch Holder

Ningbo Luke Automotive Supplies Ltd. , https://www.car-phone-holder.com