tigrawap / slit

slit - a modern PAGER for viewing logs, get more than most in less time
Other
469 stars 19 forks source link

Slit - a modern $PAGER for noisy logs

The goal is to get more from logs than most other pagers can - and to do so in less time.

Slit supports opening a single file (for now), or reading input from stdin. Slit is runs in terminal mode, writing directly to the screen, without cluttering the terminal buffer with all the logs you are reading.

Live demo

Live demo

The best way is to get Go on your system and compile yourself. It's easier than it sounds:

If you prefer pre-built binaries, head over to the releases page - https://github.com/tigrawap/slit/releases. Keep in mind, however, that they might be some commits behind master branch.

Key bindings:

Search/Filters
Navigation
Misc

Search modes

Both search and filters currently support the CaseSensitive and RegEx modes. To switch between modes press CTRL + / in search/filter input.

TODO: History does not preserve mode of previous searches. Will be improved soon

Note: For case-insensitive search in RegEx* mode use (?i)cOnDiTiOn
TODO: This will be replaced with a separate toggle in the future

Command line arguments

Highlighting

Filters

Filters can be chained - the first 'append' filter (if it is the first to be used) will work as an inclusive filter. When adding filters the active line position (at the top of the screen) will remain the same (…as possible).

Chaining of filters gives you the ability to filter out all the 'noise' dynamically, and get to what you're actually looking for.

Imagine: you have a huge log file with hundreds of thousands of lines from multiple threads. All that you're interested in are logs from "Thread-10, "MainThread"; you're not interested in "send" and "receive" messages. In addition, you want to see "Exception"s, even if they're on lines that were excluded by previous filters.

The following chain of filters will output the expected result:

&Thread-10
+MainThread
-receive
-send
+Exception

Filter files

You can save the lines above to a separate file and specify its name using the command line argument --filters.

Notes:

Inline filters

You can also add semicolon separated inline filters in the argument --filters with or without filter file names (the last
should also be separated by semicolon). e.g.:

$ slit --filters="nginx_php_errors;-debug.php;+WARN" /var/log/nginx/error.log

…will apply filters from the file "nginx_php_errors", then remove lines without substring "debug.php" and add the lines
with substring "WARN".

Notes:

Filter TODOs:

MIT License