Real-time metrics for nginx server
Project description
ngxtop parses your nginx access log and outputs useful, top-like, metrics of your nginx server. So you can tell what is happening with your server in real-time.
Installation
pip install ngxtop
Note: ngxtop is primarily developed and tested with python2 but also supports python3.
Usage
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 are written to the access log. Use this flag to tell ngxtop to process the current content of the access log instead. -t <seconds>, --interval <seconds> report 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 of output for default query [default: count] -n <number>, --limit <number> limit the number of records included in report for top command [default: 10] -a <exp> ..., --a <exp> ... add exp (must be aggregation exp: sum, avg, min, max, etc.) into output -v, --verbose more verbose output -d, --debug print every line and parsed record -h, --help print this help message. --version print version information.
Samples
Default output
$ ./ngxtop.py 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 |
View top source IPs of clients
$ ./ngxtop.py top remote_addr running for 20 seconds, 3215 records processed: 159.62 req/sec top remote_addr | remote_addr | count | |-----------------+---------| | 118.173.177.161 | 20 | | 110.78.145.3 | 16 | | 171.7.153.7 | 16 | | 180.183.67.155 | 16 | | 183.89.65.9 | 16 | | 202.28.182.5 | 16 | | 1.47.170.12 | 15 | | 119.46.184.2 | 15 | | 125.26.135.219 | 15 | | 125.26.213.203 | 15 |
List 4xx or 5xx responses together with HTTP referer
$ ./ngxtop.py -i 'status >= 400' print request status http_referer running for 2 seconds, 28 records processed: 13.95 req/sec request, status, http_referer: | request | status | http_referer | |-----------+----------+----------------| | - | 400 | - |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ngxtop-0.0.1.tar.gz
(7.7 kB
view details)
Built Distribution
File details
Details for the file ngxtop-0.0.1.tar.gz
.
File metadata
- Download URL: ngxtop-0.0.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0665429e6d31b3fbc5b43d470d85f7d86721862f34b467400363097829c74b0 |
|
MD5 | e4163a8224dd7f89d6f99a077aa09236 |
|
BLAKE2b-256 | c62cccc595c1e104e39a5c5dcfdb11f9b9944864afe53e38075bc5f5774b1c70 |
File details
Details for the file ngxtop-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: ngxtop-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac4499b62a65f799059458959c7ebdc5cbb7765bef0be0a5b0d142da8015d98e |
|
MD5 | cbc34e42d6fb52ee71b4fb3880fe6968 |
|
BLAKE2b-256 | f6104bc197028b86c3602e14934fef81f6a13952195db50b4a07348e8881aaaa |