@laphilosophia/log-scrub
v1.0.0
Published
CLI utility to sanitize and beautify JSON logs - redacts sensitive data with syntax highlighting
Maintainers
Readme
log-scrub
A CLI utility that sanitizes and beautifies JSON logs from stdin. Automatically redacts sensitive data like passwords, tokens, and API keys while providing colorful, readable output.
Features
- 🔒 Sensitive Data Redaction - Automatically masks passwords, tokens, secrets, and other sensitive fields
- 🎨 Syntax Highlighting - Color-coded JSON output for better readability
- ⚡ Stream Processing - Processes logs in real-time via stdin
- 🔧 Customizable - Configure which keys to redact and replacement text
Installation
npm install -g log-scrubUsage
Pipe any JSON logs through scrub:
# Basic usage
cat app.log | scrub
# Docker logs
docker logs my-container | scrub
# Tail and scrub
tail -f /var/log/app.log | scrubOptions
-k, --keys <list> Comma separated keys to redact
(default: password,token,secret,key,auth,credit_card,cvv,authorization)
-r, --replacement <text> Replacement text (default: "***** [REDACTED] *****")
-c, --compact Compact JSON output (no pretty print)
-V, --version Output version number
-h, --help Display helpExamples
# Custom keys to redact
echo '{"username":"john","ssn":"123-45-6789"}' | scrub -k ssn,dob
# Custom replacement text
echo '{"password":"secret123"}' | scrub -r "[HIDDEN]"
# Compact output
echo '{"name":"John","token":"abc123"}' | scrub -cOutput
Before:
{"user":"john","password":"secret123","token":"abc-xyz"}After:
{
"user": "john",
"password": "***** [REDACTED] *****",
"token": "***** [REDACTED] *****"
}License
MIT
