pipo. docs

error-tail

Follows logs/app.log, a JSON-lines log, and appends its errors to out/errors.jsonl (docs/spec.md §3.3.2).

bun pipo start examples/error-tail/error-tail.pipo
mkdir -p examples/error-tail/logs
echo '{"time":"2026-01-01T09:00:00Z","level":"info","msg":"started"}' >> examples/error-tail/logs/app.log
echo '{"time":"2026-01-01T09:00:01Z","level":"error","msg":"disk full"}' >> examples/error-tail/logs/app.log
cat examples/error-tail/out/errors.jsonl

Rotate the log (mv app.log app.log.1) and keep writing: the old file is read to its end before the new one.

error-tail.pipo#

# Follow a JSON-lines log and keep its errors (docs/spec.md §3.3.2). The position in the file is saved with each
# packet, so a restart picks up exactly where it stopped, even after a crash.
pipo: 1
name: error-tail
description: Errors from a JSON-lines application log
input:
  via: tail
  with: { path: ./logs/app.log, parse: json, from: start }
nodes:
  errors:
    from: input
    filter: data.level == "error"
  shape:
    from: errors
    transform: map
    with:
      data: { at: "${data.time}", message: "${data.msg}", where: "${meta.source}" }
output:
  from: shape
  to: file
  with: { path: ./out/errors.jsonl, format: jsonl }

Source: examples/error-tail.