LogWisp

Live on this site

Pipeline-based log transport: tail, filter, format, fan out. Compose one here or watch one live

About

LogWisp started as a way to stop SSH-ing into servers to tail and grep log files (the story). It is now one static binary, lw, that runs anything from a shell filter to a multi-node aggregation topology, and composes its own configuration on a terminal or on this page.

Pipelines
Each pipeline is independent: sources feed a flow that rate-limits, filters and formats, and the flow fans out to any number of sinks.
Never blocks
A full queue drops and counts its own entries rather than stalling the stages around it, so a slow reader costs only itself.
Chaining
Links carry the structured entry, not formatted text, so a relay can filter and reformat as if the entries were local, and every entry keeps the node it came from.
Security
TLS 1.2/1.3 everywhere, mutual TLS with identity-based authorization, and Argon2id-SCRAM passwords. lw tls makes the certificates, or a listener makes its own at startup. A listener can also hold a single SCRAM user with no credentials file, its password read from a file, a descriptor or the terminal, where Enter alone draws a 130-bit one. Unknown configuration keys are refused.
Access
Every listener can refuse addresses by allow and deny lists before the TLS handshake, cap each client's connections (and over HTTP its request rate), and read the client's address from a load balancer's PROXY header.
Viewer
A browser at an HTTP sink gets a live page that follows the stream, with a search and a level filter; a sink that keeps a backlog shows the latest entries first. Behind a site's TLS proxy it signs in with SCRAM.
Presets
pipe, tail, serve, edge and aggregator build the common pipelines from a few keys, and lw preset serve prints the file one expands to. An aggregator and an edge given the same user make a temporary authenticated pipe between two hosts, with nothing written to disk.
Compose
lw --tui composes pipelines on a terminal, and the Configure tab does it in the browser: both run LogWisp's own engine, here compiled to WebAssembly, and write the same file, command line or environment. On the terminal they also run in place: a live view shows every entry, parsed from JSON, logfmt, journald and the common loggers' lines, with the stage or filter that dropped it, one key from editing that stage. lw --check names every problem of each part, a line each, by its key's path.
Reload
Edit the TOML and the service rebuilds itself. A candidate that fails validation leaves the running pipelines untouched.
Filter
With no file and no options, lw is a Unix filter: stdin to stdout, line for line.

Pipeline

Every plugin LogWisp ships, in one pipeline, drawn from the schema its engine writes. A configuration picks any number of sources and sinks; the flow stages are each optional and run in this order.

Sources

  • console Reads stdin; the source when none is given
  • file Tails every matching file in a directory, through rotation
  • random Generated entries, to check a deployment before real logs
  • null Holds a source's place until one is chosen
  • tcp_chainlistens Entries from another node over one persistent stream
  • http_chainlistens Entries from another node in batches over POST

Flow

  1. rate_limit Token bucket, and a cap on entry size
  2. filters Include and exclude RE2 patterns, in order
  3. format raw, txt or json, with a sanitizer policy
  4. heartbeat A keep-alive entry on a timer

Sinks

  • console stdout or stderr, levels in colour
  • file Rotating files with size caps and retention
  • null Discards; holds a sink's place until one is chosen
  • tcplistens Formatted lines broadcast to every client
  • httplistens Server-Sent Events and status; a browser viewer with search
  • tcp_chaindials To the next node; holds entries across reconnects
  • http_chaindials To the next node in batches, with retry
listens accepts connections, dials makes them; every listener takes address rules and per-client limits. A chain sink on one node feeds a chain source on the next.
Entries
A source turns each line into a structured entry: time, level, message, optional JSON fields, and the node it came from. The formatter renders it for the sinks, which also receive the entry itself.
Drops
Every queue is bounded. A full one drops the entry for that stage, sink or client alone and counts it. The console sink waits instead, so a filter loses no line to a slow reader; the TCP chain sink holds a line across reconnects, so an outage downstream surfaces as counted drops upstream, not silent loss.
Topologies
An edge node tails local files and dials an aggregator; the aggregator listens for its edges and serves one stream, or writes one archive. Two presets build them, below: the aggregator makes its certificate at startup and logs the key edges pin, and each edge logs in with its own SCRAM user.
# on the aggregator: a user for each edge, its generated password in a file
lw auth add-user --credentials /etc/logwisp/users.toml -u edge-01 \
  --password-file /etc/logwisp/edge-01.pass
# the aggregator: edges' entries into files under /var/log/edges/
lw -p aggregator:users=/etc/logwisp/users.toml,out=/var/log/edges/

# each edge, given its password file: a directory's files, to the
# aggregator whose logged key it pins
lw -p edge:path=/var/log/app/,to=agg.example.org:9000,pin=sha256//BASE64,\
user=edge-01,password_file=/etc/logwisp/edge-01.pass

Configure

Compose pipelines here and take them away as a configuration file, a command line or environment variables. Start from a preset, an empty pipeline or a configuration you paste, or, where the Describe box is offered, from a sentence; then choose a part of the pipeline to set its options. Every list, default and rule comes from LogWisp’s own engine running in your browser, and nothing you enter is sent anywhere but a description you send for a draft. On the host, lw --check -c logwisp.toml remains the authority for files, certificates and credentials.

LogWisp's own engine, 7.4 MB of WebAssembly, fetched when this tab first opens.

The configurator needs JavaScript and WebAssembly. Without them, LogWisp's annotated configuration lists every option, and lw --tui composes pipelines on a terminal.

Live

The ViF multiplayer lobby streams every game server’s log through one LogWisp pipeline, running on the node beside the cluster rather than in it. Open its Log tab and start a game to watch it fill.

From

ViF game serversEach pod writes its own file of JSON records, every record carrying the game's id, to a memory-backed volume shared on the node

Sources

  • file Tails every game's file in that volume as it is written

Flow

  1. rate_limit 400 records a second, bursts of 800, the rest dropped
  2. filters Leaves out TRACE records and the admission records that name a player's address
  3. format raw: each JSON line as written

Sinks

  • httplistens One Server-Sent Events stream, on the node's loopback only

To

The lobby's Log tabThe game allocator relays that stream unchanged as /vif/api/logs behind the site's nginx; the page filters by game id

Install

Runtime

  • Platforms: Linux and FreeBSD on amd64, natively or in a container
  • Toolchain: Go 1.27.3, no CGO, one static binary
  • Libraries: Terminal, Color, TOML, Config, Log and Auth
  • Configuration: a TOML file, or the same keys as flags and environment variables
  • Presets: pipe, tail, serve, edge and aggregator
  • License: BSD-3-Clause

Install

Build
git clone https://github.com/lixenwraith/logwisp --depth 1, then cd logwisp && make release for a static, stripped bin/lw
Service
sudo make install adds lw, its manual and completion, a systemd unit or rc.d script, and the annotated logwisp.toml to edit; make deb and make arch package the same
One user
Without root, make release install puts lw, its manual and completion under ~/.local, with no service; then lw config init writes the file lw reads
Container
make image builds a scratch image that runs read-only with no capabilities
Fleet
deploy/lw-deploy.sh sets up an edge, an aggregator or a standalone node, as a container or a systemd or rc.d service

Quick start

# a filter: errors and warnings only
tail -F app.log | lw --filter include:patterns=ERROR,patterns=WARN

# stdin as a live SSE stream, with a browser viewer at http://127.0.0.1:8080/
journalctl -f | lw --sink http:host=127.0.0.1,port=8080

# a directory's logs, served to one subnet
lw -p serve:path=/var/log/app/,listen=0.0.0.0:8080,allow=192.0.2.0/24

# any command line as a configuration file
lw -p serve:path=/var/log/app/ --dump > logwisp.toml

# compose pipelines on screen, then run, tap or print them
lw -T

# tap a stream: each line parsed, and what the flow did with it
journalctl -f -o json | lw -T -p pipe

# a temporary pipe, nothing on disk: Enter at the receiver's prompt draws
# the password, which the sender's prompt takes
lw -p aggregator:listen=0.0.0.0:9000,user=pipe,format=raw,allow=192.0.2.10/32
cmd | lw -p edge:to=192.0.2.20:9000,pin=sha256//BASE64,user=pipe