Master Real-Time Nginx Log Monitoring with ngxtop on Linux
This guide explains how to install ngxtop on CentOS 7, outlines its key features for real‑time Nginx log analysis, and demonstrates common commands for monitoring request counts, top client IPs, filtering 404 responses, and analyzing access logs both live and offline.
Linux operations engineers must ensure 24/7 service stability, and monitoring web server logs is essential. While many start with tail -f /path/to/log, using that for multiple sites quickly becomes unwieldy. This article introduces a powerful Nginx log monitoring tool called ngxtop .
ngxtop is a Python‑based program that parses Nginx access logs in real time and outputs useful metrics to the terminal.
Key Features
Current active requests
Total request count summary
Total requests by status code (2xx, 3xx, 4xx, 5xx)
Average bytes sent
Top remote addresses
In addition to real‑time monitoring, ngxtop can also analyze historic logs.
Installing ngxtop on Linux
The following steps were tested on CentOS 7 (64‑bit).
First, install pip (the Python package manager).
Log in to your server with root credentials.
Enable the 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
# Install pip
yum install python-pip
# Install ngxtop
pip install ngxtopDetailed Usage of ngxtop
Usage:
ngxtop [options]
ngxtop [options] (print | top | avg | sum)<var>
ngxtop infoOptions:
ngxtop in Practice
1. View request summary, URIs, and status code counts
$ ngxtop2. Check top client IP addresses
Identify which IPs are sending the most requests to your Nginx server. ngxtop top remote_addr 3. Show only HTTP 404 requests
ngxtop -i'status>= 404'4. Analyze a specific access.log file ngxtop -l /path/access.log 5. Parse an offline Apache access.log ngxtop -f common -l /path/access.log You can combine various filters to extract the exact data you need from access logs.
GitHub repository: https://github.com/lebinh/ngxtop
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
