Rhit reads your nginx log files (even gzipped), does some basic analysis and tells you about it in pretty tables in your console, storing and polluting nothing.
It lets you filter hits by dates, or by patterns on referers and paths.
And it's fast enough (about one second per million lines) so you can iteratively try queries to build your insight.
You need the Rust toolchain. Do
bash
cargo install rhit
Rhit is only tested on linux.
If rhit is on the server, and the logs are at their usual location:
bash
rhit
(you may have to prefix with sudo to read the files in /var/log
)
Tell rhit what files to open:
bash
rhit ~/trav/nginx-logs
bash
rhit -p download
bash
rhit -p "^/blog/.*broot"
bash
rhit -r reddit
As for the path, you may use a regular expression.
bash
rhit -d 12/25
If the log contains several years, you need to precise it, eg rhit -d 2020/12/25
.
Symmetrically, you may omit the month if it's not ambiguous: rhit -d 25
.
bash
rhit -d 2020/12/25-2021/01/03
The syntax is quite versatile:
bash
rhit -s 404
rhit -s 5xx
rhit -s 3xx,410-421
rhit -s 301-305
The displayed tables (all by default) can be chosen with the -t
argument.
For example to only show remote adresses and paths, use:
bash
rhit -t addr,paths
(use rhit --help
for the complete list)
Table lengths is decided with the -l
argument. Use rhit -l 0
to have just a few lines in the various tables, and rhit -l 5
for huge tables. Default value is 1
.