A production-grade, composable intelligent log parsing engine for Node.js and Browser — built on TypeScript with dependency-injection-driven architecture.
log-parser transforms unstructured log messages into structured templates with typed parameters. It composes a high-performance data plane (drain-ts prefix-tree clustering, 99% of logs, zero network) with an optional LLM control plane for semantic understanding of unknown patterns. The entire pipeline is driven by dependency injection — swap any component without touching the framework.
Raw Log → [Preprocessor] → [Data Plane: drain-ts] → [SynLogRefiner] → [Control Plane: LLM] → Template
│ │ │ │
Language detection Prefix-tree Regex anonymization ILLMProvider (DI)
Multi-lang tokenize Masking Cross-group verify Adaptive batching
Structured extract Persistence Post-processing Self-reflection
- DI-driven architecture —
ILLMProviderandIEmbeddingProviderinjected at construction; undefined = pure drain-ts mode - Dual-runtime — Node.js and Browser share the same
corepackage; platform-specific I/O innodeandbrowserpackages - SynLogTemplateRefiner — SynLogPlus-inspired template post-processing boosting PTA by 236% on syntax-based parsers
- Adaptive LLM batching — packs clusters into context-window-aware batches; 25 API calls for 16 LogHub-2k datasets vs 460 for naive per-cluster
- Granularity Distance + HITL — Needleman-Wunsch alignment distinguishes granularity preferences from parsing errors
- ConfigAutoTuner — staged grid search optimizing 9 hyperparameters; WeeklyReplay pipeline for offline-to-production config optimization
- Real WebLLM — browser-local LLM inference via
@mlc-ai/web-llmwith WebGPU acceleration; zero data egress - Verified benchmarks — 16/16 LogHub-2k datasets, GA 0.991, PTA 0.842 (LLM-enhanced), results published live
Layered strategy: install only the packages you need.
corealone provides drain-ts template mining. Addllmfor LLM enhancement. Addwebllmfor browser-local inference. Addserverfor REST API.
npm install @agentix-e/log-parser-coreimport { LogParserPipeline } from '@agentix-e/log-parser-core';
const pipeline = new LogParserPipeline();
pipeline.parse('User alice logged in from 192.168.1.1');
// { template: "User <*> logged in from <IP>", source: "drain-strict" }
pipeline.parse('User bob logged in from 10.0.0.1');
// { template: "User <*> logged in from <IP>", source: "drain-strict" }npm install @agentix-e/log-parser-core @agentix-e/log-parser-llmimport { LogParserPipeline } from '@agentix-e/log-parser-core';
import { OpenAICompatibleProvider } from '@agentix-e/log-parser-llm';
const llm = new OpenAICompatibleProvider({
provider: 'ollama',
model: 'qwen2.5:7b',
baseURL: 'http://localhost:11434/v1',
});
const pipeline = new LogParserPipeline({ llmProvider: llm });<script type="module">
import { LogParserPipeline } from '@agentix-e/log-parser-core';
import { WebLLMProvider } from '@agentix-e/log-parser-webllm';
const llm = await WebLLMProvider.create({ model: 'gemma-2-2b-it-q4f16_1-MLC' });
const pipeline = new LogParserPipeline({ llmProvider: llm });
</script>npm install @agentix-e/log-parser-core @agentix-e/log-parser-server @agentix-e/log-parser-llmimport { createServer } from '@agentix-e/log-parser-server';
const server = await createServer({ llmProvider: /* optional */ });
await server.listen({ port: 3000 });Endpoints: POST /api/v1/parse, GET /api/v1/templates, POST /api/v1/calibrate, GET /api/v1/stats, GET /api/v1/health
All 16 LogHub-2k datasets, drain-ts comparison, LLM cost analysis.
| Metric | drain-ts | log-parser drain-only | log-parser +LLM/SynLog |
|---|---|---|---|
| Avg GA | 0.991 | 0.990 | 0.990 |
| Avg PTA | 0.827 | 0.825 | 0.842 |
| Datasets passed | 16/16 | 16/16 | 16/16 |
| LLM calls | — | — | 25 |
| Est. LLM cost | — | — | ~$0.01 |
git clone https://github.com/AgentiX-E/log-parser.git
cd log-parser
pnpm install
pnpm build
pnpm test
pnpm test:coverageMIT © 2026 AgentiX-E