Skip to content

Reference ​

Every option, key, indicator and limit in LogLens 0.2.0.

Command line ​

text
loglens [OPTIONS] FILES...
Argument or optionWhat it does
FILES...One or more log files to tail. Required. Each must exist and must be a file, not a folder.
--versionPrints loglens, version 0.2.0 and exits.
--helpPrints the usage text and exits.

There are no other options and no configuration file. Format detection, colours and limits are automatic.

Each file gets a label from its file name. When two files share a name, the label adds the parent folder, for example web/access.log and api/access.log. Labels are coloured in turn cyan, magenta, green, yellow, blue and bright red, then the colours repeat.

Key bindings ​

KeyAction
/Open the regex filter. It applies as you type. Enter keeps it, Esc clears it.
eTurn errors-only on or off. Traceback lines stay with their error.
pPause or resume. Resuming clears any active search.
sOpen buffer search. Enter jumps to the newest match and pauses.
nNext older match, wrapping to the newest.
NNext newer match, wrapping to the oldest.
tShow or hide the error histogram.
cOpen the error clusters panel. In the panel, c closes it.
wOpen export, with a timestamped file name filled in. Enter writes the file.
qQuit.
↑ ↓ PgUp PgDnScroll the log view, or move through the clusters list.
EnterIn the clusters panel: jump to the newest error in the selected group and pause.
EscCloses or clears one thing; see below.

Esc does the first of these that applies:

  1. Closes the clusters panel.
  2. Closes the export box.
  3. Closes the search box.
  4. Clears the active search.
  5. Clears the regex filter.

Status bar ​

The top line always shows LogLens v0.2.0, the label of each file, and lines: with the number of lines read since start-up. It adds these when they apply:

IndicatorMeaning
PAUSEDThe view is paused.
ERRORSErrors-only is on.
/pattern/A regex filter is active.
invalid regexThe text in the filter box is not a valid pattern. The last valid filter still applies.
?pattern? match 3/12A search is active: match 3 of 12, counted from the oldest.
?pattern? no matchesA search is active but found nothing.
invalid search regexThe search pattern is not valid.

Log formats ​

LogLens reads up to the first 8 KB of each file when it starts and picks the format that fits best. Each file is detected on its own, so different files can use different formats. The choice is made once, at start-up.

FormatRecognised byHow the level is found
JSON linesEach line is a JSON objectFrom level, lvl, severity or log.level, the first one present.
Syslog (RFC 3164)A Mon DD HH:MM:SS host proc[pid]: message headerFrom words in the message: error, fail, failed or failure give ERROR; warn or warning give WARN; debug gives DEBUG. Otherwise no level.
nginx access log (combined)ip - - [time] "METHOD path HTTP/x.x" status bytes "referer" "agent"From the HTTP status: 5xx is ERROR, 4xx is WARN, anything else INFO.
nginx error logyyyy/mm/dd hh:mm:ss [level] pid#tid: messageFrom the level in square brackets.
Generic (fallback)A leading timestamp, or a level word anywhere in the lineFrom the first level word in the line.

For JSON lines, the time comes from ts, time, timestamp or @timestamp (ISO 8601, or seconds or milliseconds since 1970) and the message from msg, message or event.

In the generic format, a line that is indented, or starts with Traceback (most recent call last), File or at , is joined to the record above it and shares its level.

Level words are matched without regard to case. WARN and WARNING count as WARN. ERROR, ERR, CRITICAL, CRIT, FATAL, ALERT and EMERG all count as ERROR.

The time shown in front of each line is the time parsed from the line when there is one, otherwise the time LogLens read the line.

Colours ​

LevelColour
ERRORBold red
WARNYellow
DEBUGDim
INFO, or no levelNormal
Traceback and continuation linesDim

Limits ​

ItemValue
Lines kept in memory100,000 per session; the oldest are dropped first
Lines loaded from each file at start-upThe last 50
Lines drawn in the viewThe newest 1,000 that pass the filters
Format detection sampleFirst 8 KB of each file
Histogram15 one-minute bars, updated every second
Clusters panel refreshEvery 2 seconds, when new lines have arrived

Export file names ​

The default export name is loglens-export-YYYYMMDD-HHMMSS.log, using the local date and time. A relative path is saved relative to the folder you started LogLens from. Existing files are never overwritten.

Sample log generator ​

The source folder includes scripts/genlog.py, which writes sample log lines for trying LogLens. It needs only Python.

text
python3 scripts/genlog.py OUTPUT [--format F] [--count N] [--rate R]
                          [--error-rate X] [--seed N] [--rotate-every N]
OptionDefaultWhat it does
OUTPUTThe file to write. It is emptied first.
--format Fmixedjson, syslog, nginx, generic or mixed (a random mix of all four).
--count Nrun foreverStop after N entries.
--rate R10Entries per second.
--error-rate X0.1Share of entries that are errors, from 0 to 1.
--seed NrandomSeed, so the same output can be produced again.
--rotate-every NoffEmpty the file after every N entries, to test rotation handling.

Stop it with Ctrl + C.

Next steps ​