ngxtop 允許你對 NGINX 的訪問日誌 (access log) 進行實時解析, 並輸出類似 top 的有用資訊。
透過下列命令可以安裝 ngxtop:
pip install ngxtop
在執行 ngxtop 後,它將預設輸出如下資訊:
$ ngxtop
running for 411 seconds, 64332 records processed: 156.60 req/sec
Summary:
| count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|---------+------------------+-------+-------+-------+-------|
| 64332 | 2775.251 | 61262 | 2994 | 71 | 5 |
Detailed:
| request_path | count | avg_bytes_sent | 2xx | 3xx | 4xx | 5xx |
|------------------------------------------+---------+------------------+-------+-------+-------+-------|
| /abc/xyz/xxxx | 20946 | 434.693 | 20935 | 0 | 11 | 0 |
| /xxxxx.json | 5633 | 1483.723 | 5633 | 0 | 0 | 0 |
| /xxxxx/xxx/xxxxxxxxxxxxx | 3629 | 6835.499 | 3626 | 0 | 3 | 0 |
| /xxxxx/xxx/xxxxxxxx | 3627 | 15971.885 | 3623 | 0 | 4 | 0 |
| /xxxxx/xxx/xxxxxxx | 3624 | 7830.236 | 3621 | 0 | 3 | 0 |
| /static/js/minified/utils.min.js | 3031 | 1781.155 | 2104 | 927 | 0 | 0 |
| /static/js/minified/xxxxxxx.min.v1.js | 2889 | 2210.235 | 2068 | 821 | 0 | 0 |
| /static/tracking/js/xxxxxxxx.js | 2594 | 1325.681 | 1927 | 667 | 0 | 0 |
| /xxxxx/xxx.html | 2521 | 573.597 | 2520 | 0 | 1 | 0 |
| /xxxxx/xxxx.json | 1840 | 800.542 | 1839 | 0 | 1 | 0 |
關於 ngxtop 的更多用法,可透過 ngxtop -h 查詢。