This tool is a rewrite of ngxtop to make it more easily installed and hopefully quicker. For those unfamiliar with the ngxtop, it is a tool that helps you parse NGINX access logs and print various statistics from them regardless of format. It is currently not feature complete with the original version but it should have enough functionality to be usable.
For those who have Rust installed, you can download it from crates.io:
sh
cargo install topngx
```sh topngx 0.1.0 Garrett Squire github@garrettsquire.com top for NGINX
USAGE: topngx [FLAGS] [OPTIONS] [SUBCOMMAND]
FLAGS: -h, --help Prints help information -n, --no-follow Do not tail the log file and only report what is currently there -V, --version Prints version information
OPTIONS:
-a, --access-log
SUBCOMMANDS: avg Print the average of the given fields help Prints this message or the help of the given subcommand(s) info List the available fields as well as the access log and format being used print Print out the supplied fields with the given limit query Supply a custom query sum Compute the sum of the given fields top Find the top values for the given fields ```
Some example queries are:
```sh
topngx < /path/to/access.log
topngx info
topngx query -q 'select * from log where bytessent > 100' -f requestpath bytes_sent < access.log ```
The original version could tail log files in real time. Currently topngx can not do this but I am
exploring options on how this can be done. Ideally I could use some implementation that is able to
be Read
from. There is also no option to filter the data but this could be added in the future.
The original version allowed for automatic detection of NGINX configuration files, log file
paths, and log format styles. topngx currently has command line options for these and may add this
functionality in a later version.
If you find any other issues or features that may be missing, feel free to open an issue.
MIT
The ngxtop license can be seen here.