← Back to all projects
📜

Open source · vishwajit-vm Designed · Phase 1

Strutvane Logs

Zero-config logging with a built-in log viewer

@strutvane/logs gives any Node app structured, non-blocking logs with zero configuration: automatic request and error logging, daily files with size caps and retention, secret redaction before anything is stored, and a built-in viewer at /_strutvane/logs with live tail, search and download. It is installed by default in Strutvane apps and also works in Express, Fastify, Hono and NestJS.

1.3–4× faster than pino+2.9 ms p99spike · 44 tests

Built for: Any Node.js app — Express, Fastify, Hono or NestJS — and every Strutvane app by default.

Packages on npm

↓ Scroll to explore the problem, architecture and stack

😩

The problem

Good logging takes a day of setup — transports, rotation, retention, redaction, a way to read logs — and logs often leak secrets or slow requests down.

💡

Why it matters

Making safe, fast logging the default means every app starts with searchable logs and no leaked tokens — and the logger is designed to never crash the app it is watching.

What you can do with it

01Log structured records with automatic context (request id, actor, tenant).
02Log every request and exception automatically.
03Rotate files daily with size caps and 60-day retention.
04Redact secrets before storage.
05Read logs in a built-in viewer with live tail, search and download — local-only or permission-gated, and tenant-scoped.

How it’s built

A simplified view of the architecture — follow the dots as a request moves down the layers.

Your app
log.info(…)Express · Fastify · Hono · Nest
Pipeline
ContextAsyncLocalStorage
Redactionkeys + 5 patterns
Writer
Priority queuebounded
Batched appendsone file per process
Viewer
/_strutvane/logstail · search · download

A request, step by step

  1. Your code logs a record; the current request context is attached automatically.
  2. Sensitive keys and five secret patterns are redacted before anything is serialized.
  3. The record becomes one line (max 32 KB) and joins a bounded priority queue.
  4. A writer flushes batches with appends, one file per process, rotating daily within size caps.
  5. The viewer merges every process’s files by timestamp for live tail and search.

Tech stack

Runtime
Node.jsTypeScript
Integrations
ExpressNestJSHonoFastify
Observability
OpenTelemetry

What I built

  • Designed the logging pipeline and viewer (RFC-0004).
  • Benchmarked it in spike 09 (44 tests plus a Linux-only test, 4 planted bugs caught): 1.3–4× faster than pino when writing files, adding only 2.9 ms at p99 under HTTP load.
  • Replaced a shared log file — which broke size rotation across processes in 24 of 28 files — with one file per process, merged by timestamp in the viewer (ADR-0015).
  • Fixed a shutdown bug that lost the exit code, using a flush deadline timer, and kept memory bounded by dropping low-severity records first and reporting the drop count.

Hard problems & how I solved them

❓ Rotation broke across processes.

✅ Each process writes its own file and the viewer merges them by timestamp (ADR-0015).

❓ Never crash or bloat the app.

✅ A bounded queue drops low-severity records first and reports the drop count; a flush deadline keeps exit codes intact.