Skip to content

Getting Started

LogStrip is primarily distributed as an npm CLI. This page covers the fastest path from "I have a noisy log" to "I have a compact, LLM-ready artifact".

1. Install the CLI

LogStrip requires Node.js 20 or newer.

npm install --global logstrip

The package registers the logstrip binary.

Don't want a global install? Use npx:

npx -y logstrip raw.log -o clean.log

2. Trim your first log

Three equally valid ways to feed the parser:

# File in, file out
logstrip raw.log -o clean.log

# Unix pipe
cat raw.log | logstrip > clean.log

# File in, compressed log to stdout, stats to stderr
logstrip raw.log --stats > clean.log

PowerShell:

Get-Content raw.log | logstrip > clean.log
logstrip raw.log --stats > clean.log

The default aggressiveness is auto, which starts at high and adapts to the log while running every detection booster automatically. Override with -a low|medium|high|aggressive for a fixed level.

3. Wire it into a script

#!/usr/bin/env bash
set -euo pipefail

npm test > raw.log 2>&1 || true   # keep the log even on failure
logstrip raw.log -o clean.log --stats
your-ai-agent analyze --file clean.log

4. Read the stats

When --stats is set the CLI prints a compact report to stderr:

LogStrip compression report
  input lines     : 4128
  output lines    : 312
  dropped lines   : 3640
  duplicate lines : 87
  hidden internal : 89
  input tokens    : 21450
  output tokens   : 4138
  saved tokens    : 17312
  savings         : 80.71%
  output path     : clean.log

Need the same report machine-readable? Use --json (requires --output):

logstrip raw.log -o clean.log --json

5. (Optional) Use it in GitHub Actions

If you do not want a run: step calling the CLI, the same engine is exposed as a thin GitHub Action wrapper. See GitHub Action for the full contract.

- name: Run tests and keep raw logs
  run: npm test > raw_logs.txt 2>&1 || true

- name: Compress logs with LogStrip
  uses: mrwogu/logstrip@v1
  id: logstrip
  with:
    log-path: raw_logs.txt
    aggressiveness: auto

- name: Analyze compact logs
  run: your-ai-agent analyze --file "${{ steps.logstrip.outputs.output-path }}"

Next steps

  • CLI Reference - every flag, exit code, JSON schema.
  • Configuration - custom sources and patterns via .logstrip.yml.
  • Agent Plugins - drop-in instructions for Claude Code, Copilot, Cursor, Codex, Droid, and OpenCode.
  • Examples - real-world CI recipes.

Want to hack on LogStrip itself? See CONTRIBUTING.md.