1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
NAME
logserver - a fast pager designed for rapid navigation and multiple keyword searching on giant log files
SYNOPSIS
logserver [inputfile]
DESCRIPTION
logserver is an ncurses pager that streams a file and makes searching and
navigating it easy. It is designed to help explore and search log files when
you may not exactly know what you are looking for.
It begins in command mode and operates with keybindings.
Some keybindings switches to input mode, where the keys are accepted as an
input until enter (accept) or escape (reject) is used to return to command
mode. The centre line is highlighted and corresponds to the current line that
is being viewed. Commands that operate on a line thereby operate on this
highlighted one.
KEYBINDINGS FOR NAVIGATION:
arrows: Move around in the file. Long lines do not wrap so left and
right moves accordingly.
home: Move to the top of the file.
end: Move to one-past the end of the file, which will display
streaming data
shift+home: move left to the start of the line
shift+end: move right to the end of the line
page-up: move to the top line visible
page-down: move to the bottom line visible
colon: accepts a number afterwards, and moves to that line number
KEYBINDINGS FOR SEARCHING:
slash: Accepts a keyword afterwards, and adds it as a search term.
backslash: Accepts a keyword afterwards, and adds it as a reverse search.
caret: Accepts a keyword afterwards, and adds it as a starts with search.
dollar sign: Accepts a keyword afterwards, and adds it as an ends with search.
tab: Alternates among search modes.
ALL mode shows all lines and highlights matching keywords.
OR mode (disjunctive) shows lines that match any keyword.
AND mode (conjunctive) shows lines that match all keywords.
shift+left: move left on the current line to the next matching keyword
shift+right: move right on the current line to the next matching keyword
shift+up: In ALL mode, moves up to the next line that matches any keyword.
In OR mode, moves up to the next line that matches a keyword
that is not matched on the current line. Useful for staying in
OR mode but skipping large amounts of the same match.
shift+down: Same as shift+up but searches downwards.
backspace: Removes the most-recently added search term.
plus: Add one more line of context around matching lines.
minus: Remove one line of context around matching lines.
KEYBINDINGS FOR LINE OPERATIONS:
octothorpe: Accepts a string afterwards, and adds the current line and
surrounding view along with that comment to a file in current
directory called storytime.txt.
letter e: Accepts a string starting with the current line. Changes to that
line are reflected in the display (but not the original file).
letter b: Breaks a long line up and inserts the new lines. This uses a
number of heuristics in an attempt to be elegant. It uses spaces
and punctuation to give a ragged-right in text. It uses
ampersands and equals to infer HTTP query strings and breaks on
the ampersand. It uses quotes and braces to infer JSON for
pretty printing, and it uses periodic backslash-n to infer
escape newlines and breaks on those.
letter B: Accepts a single character next, and performs the break
functionality described for the letter b using that specific
character, i.e., replaces that character with newlines.
letter i: Intelligence for lines. Replaces UNIX timestamps with human
time, and looks for sequences of base64 or base16 encoded text
based on printable characters after decoding. Repeated pressing
of 'i' softens the heuristics of how much text needs to be
printable.
letter d: If hit twice in a row, deletes the current line from the
display (not from the original file).
asterisk: Pins the current line. When searching for keywords pinned lines
will appear in OR and AND mode despite not matching.
letter s: Accepts a string afterwards, and writes the current line to the
file specified by that string.
letter f: Follows a link on the current line. If logserver is given the
output of grep -rn, then each line will link to that file and
line number and 'f' will follow it. If logserver is reading a
ctags file, then each line will be a link to that target.
letter m: Merge the next line to the end of the current line.
KEYBINDINGS FOR GLOBAL OPERATIONS AND STACKED VIEWS
letter q: Quits logserver.
letter n: Toggle line numbers on and off.
letter c: Toggle colouring on and off.
letter S: Accepts a string afterwards, and writes the entire log file to
the file specified by that string. This is useful when data is
bring streamed into logserver by program output.
letter h: Launch the help screen, pushes on the stack.
letter C: Clears the entire contents of the log. This is useful when
streaming in data, e.g., a device log, and you want the logs
relevant to a particular event that is about to be triggered.
exclamation: inserts a new pinned dash line at the current position. Appends
it if the current line is one-past the end. Useful for
separating segments of the log, such as the debug log
corresponding to right before pressing a button and right after
the program crashes, so just the area between those events is
conspicuous.
percent: In OR and AND mode, applies the current filter and creates a new
view with just the matching lines and puts that on the stack
(i.e., some percent of the logs).
In ALL mode, goes up and down from the current position
searching for a pinned like, such as one created by an
exclamation, and pushes a new view on the stack bounded by those (or the
top and bottom if none are found).
less-than: Moves left on the stack of views.
greater-than: Moves right on the stack of views.
escape: Pops the top most (right most) view on the stack. Does nothing
if there is only one view.
pipe: Accepts a string afterwards and runs that command, passing the
current view as stdin, and pushing a new view on the stack with
the stdout of the command as its contents. For security purposes
the set of commands that can be run is limited to the following:
cat, sort, uniq, ls, grep, cut, tr, sed, awk, fgrep, which,
whoami, base64, echo, file, wc, xsel, mplayer.
letter T: Consider the next key pressed as the tab character, so T-comma can be for CSVs
letter t: Toggle tab mode, where tab character and column widths are used to align tabular data
numbers 0-9: In tab mode, toggle suppression of column number. Columns are indexed starting at 1, with number ten as 0
EXAMPLES
Try this command to view the system log in logserver:
$ journalctl | logserver
$ logserver /var/log/apache2/access.log
SEE ALSO
less(1), more(1)
COPYRIGHT
Copyright (C) 2017-2025 Joel Reardon
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. See the file LICENSE. If not, see <https://www.gnu.org/licenses/>.
AUTHOR
Joel Reardon <logserver@potatocrunchcereal.com>
|