Playground

Try logpare compression in your browser

← Back to Docs
Sample Dataset

Simple log patterns with errors, info, warnings, and debug messages.

Parse tree depth (higher = more specific templates)

Matching threshold (lower = more grouping)

Output Format

Paste your own logs — everything runs locally in your browser.

Result
Input
12 lines
Templates
7
Compression
41.7%
Token savings
~8.0%
=== Log Compression Summary ===
Input: 12 lines → 7 templates (41.7% reduction)

Top templates by frequency:
1. [3x] ERROR Connection to <*> failed after <*>
2. [3x] WARN Retry attempt <*> for task-<*>
3. [2x] DEBUG Cache hit for <*>
4. [1x] INFO Request abc123 processed in <*>
5. [1x] INFO Request xyz789 processed in <*>
6. [1x] INFO Request def456 processed in <*>
7. [1x] DEBUG Cache miss for user_11111

Rare events (≤5 occurrences): 7 templates
- [3x] ERROR Connection to <*> failed after <*>
- [3x] WARN Retry attempt <*> for task-<*>
- [2x] DEBUG Cache hit for <*>
- [1x] INFO Request abc123 processed in <*>
- [1x] INFO Request xyz789 processed in <*>
... and 2 more rare templates
Equivalent code
import { compressText } from 'logpare';

const logs = `ERROR Connection to 192.168.1.100 failed after 30s
ERROR Connection to 192.168.1.101 failed after 25s
ERROR Connection to 192.168.1.102 failed after 28s
INFO Request abc123 processed in 45ms
INFO Request xyz789 processed in 52ms
INFO Request def456 processed in 38ms
WARN Retry attempt 1 for task-001
WARN Retry attempt 2 for task-001
WARN Retry attempt 1 for task-002
DEBUG Cache hit for user_12345
DEBUG Cache hit for user_67890
DEBUG Cache miss for user_11111`;

// Drain algorithm options are nested under "drain";
// "format" and "maxTemplates" sit at the top level.
const result = compressText(logs, {
  format: 'summary',
  drain: {
    depth: 4,
    simThreshold: 0.4,
  },
});

console.log(result.formatted);