🔍 LogLens AI
AI-powered log anomaly detection that reads your logs like a senior engineer.
Detect anomalies by meaning · explain them in plain English · group them into incidents · watch services live · alert Sentry-style - 100% local, zero setup, $0/GB.
pip install loglensai
→ first real insight in seconds. No account. No agent. No cloud. No bill.
Why LogLens AI
Most log platforms give you a score and a bill. LogLens AI gives you answers - and runs entirely on your own machine. It's the only log anomaly detector with published, reproducible F1, plus explainable, grouped incidents, live watching, one-line self-alerting for your own apps, and an optional AI root-cause layer.
| LogLens AI | Splunk | Datadog | Elastic ML | DeepLog (research) | |
|---|---|---|---|---|---|
| ⏱️ Setup time | seconds | days–weeks | hours–days | hours | N/A |
| 💰 Cost | $0/GB | ~$150/GB/yr | ~$0.10–1.27/GB | license | free |
| 🔒 Runs offline / air-gapped | ✅ | partial | ❌ | partial | ✅ |
| 📊 Published, reproducible accuracy | ✅ F1 0.957 | ❌ | ❌ | ❌ | ✅ (HDFS only) |
| 💬 Explains why a line is anomalous | ✅ | scores only | scores only | scores only | ❌ |
| 🧩 Groups repeats into incident families | ✅ | partial | partial | ❌ | ❌ |
| 👀 Live watch (docker / k8s / journald) | ✅ | ✅ | ✅ | partial | ❌ |
| 🚨 Self-alerting for your app (1 line) | ✅ | ❌ | agent | ❌ | ❌ |
| 🤖 AI root-cause narratives (BYO key) | ✅ | paid add-on | paid | ❌ | ❌ |
| 📄 Self-contained offline HTML report | ✅ | ❌ | ❌ | ❌ | ❌ |
In one line: the only log anomaly detector with published, reproducible F1 - free, local, explained, grouped into incidents, and able to watch and alert on your services in real time.
🚀 Install
With pip (recommended):
pip install loglensai # fast + turbo detection, watch, alerts, SDK, RCA
pip install "loglensai[deep]" # + neural (transformer) semantic mode
With Docker (nothing to install, multi-arch amd64 + arm64):
docker run --rm -v "$PWD:/data" loglensai/loglens analyze --source app.log
Requires Python 3.10+. MIT licensed.
⚡ Quick start
# analyze any log file - format auto-detected, incidents grouped
loglens analyze --source app.log
# maximum throughput on huge files
loglens analyze --source app.log --turbo
# neural semantic mode - best precision
loglens analyze --source app.log --deep
# full incident workflow: turbo scan + AI root-cause + offline HTML report
loglens analyze --source app.log --turbo --rca --html report.html
# watch a running service live - get ONLY the problems, instantly
loglens watch "docker logs -f my-api"
# ask your logs a question in plain English
loglens ask "why did the payment service start timing out?" --source app.log
# reproducible accuracy benchmark against labeled data
loglens benchmark labeled.log --min-f1 0.90
Add Sentry-style self-alerting to your own app in one line:
import loglens
loglens.init(app_name="checkout-api") # → Slack / Teams / Email on serious events
📖 Full command & SDK reference → loglensai.com/docs and DOCUMENTATION.md.
📊 Benchmarks - measured, reproducible, honest
All numbers on real labeled datasets from Loghub. Reproduce them yourself → BENCHMARK.md.
Accuracy - Loghub BGL (500,000 lines, 206,847 labeled alerts)
| Mode | Engine | Precision | Recall | F1 | Speed | Missed alerts |
|---|---|---|---|---|---|---|
| ⚡ fast | from-scratch statistical | 0.901 | 1.000 | 0.948 | ~6,700 l/s | 0 |
| 🚀 turbo | optimized statistical | 0.901 | 1.000 | 0.948 | ~7,300 l/s | 0 |
| 🧠 deep | AI semantic embeddings | 0.917 | 1.000 | 0.957 | ~3,400 l/s | 0 |
- 🎯 Zero missed alerts - 1.000 recall across all 206,847 alerts, every mode.
- 🧠 Deep mode measurably beats the baseline - semantic embeddings cut false positives ~18%. Provable AI value, not marketing.
- 🚀 Turbo matches fast-mode accuracy exactly at higher throughput - speed with no accuracy tradeoff.
Generality - no retuning (Sandia Thunderbird, 500k all-normal lines)
| Mode | False-alarm rate | Specificity | Speed |
|---|---|---|---|
| fast | 0.68% | 99.32% | ~8,600 l/s |
| deep | 0.67% | 99.33% | ~1,800 l/s |
Needle-in-a-haystack - 30/30 injected incidents caught
Kernel panic, OOM, disk failure, security breach and data corruption injected into routine logs across 6 formats (Apache, Spark, HDFS, HealthApp, OpenStack, Thunderbird): 100% recall, zero configuration.
✨ Features
🔬 Detection core
- Three engines, one unified score -
fast(from-scratch statistical: TF-IDF template embeddings, weighted density clustering, severity/rarity/chronic scoring - no ML libs in the core),turbo(same accuracy, parallel byte-range scanning + template dedup), anddeep(transformer semantic embeddings that understand log meaning, run on unique templates for speed). - Incident families - repeated anomalies collapse into one incident with an
×Ncount. No scrolling through 200 identical errors. - Explainable by default - every flag ships with a plain-language reason (rare + severe + burst context), not just a number.
- 10+ log formats auto-detected - Apache, Linux, Mac, HDFS, Spark, Zookeeper, OpenStack, Thunderbird, BGL, HealthApp & generic. No config, ever.
- Flexible ingestion - files, stdin, HTTP, and live commands.
📡 Live & always-on
loglens watch- point it atdocker logs -f,kubectl logs -f, orjournalctl -fand it prints only the problems, instantly. CRITICAL/FATAL surface immediately; Ctrl-C prints a summary (optionally with AI root-cause + HTML dashboard).- Self-alerting in one line (
loglens.init) - Sentry-style alerts to Slack / Teams / Email the moment something serious happens, including uncaught crashes. De-duplicated, rate-limited, sent from a background thread so it never risks your app. Works with zero AI setup (built-in cause hints) and gets richer with a BYO LLM key.
🤖 AI layer (bring your own key)
- AI root-cause analysis (
--rca) - BYO key (OpenAI / Azure / Groq). Sends only grouped anomaly summaries to the LLM - never your full log - so it's cheap, private, and coherent. - Natural-language Q&A (
loglens ask) - ask "why did db-service degrade?" and get an answer grounded in the detected anomalies.
🐍 Python SDK
from loglens import analyze
result = analyze("app.log") # or lines=[...], cmd="docker logs api"
for a in result.anomalies:
print(a.level, a.score, a.message, a.reasons)
print(result.rca().report) # AI root-cause (BYO key)
analyze()/analyze_async()- "here are logs, give me the problems."LogLensHandler- drop into Python'sloggingso your app raises its own alarm.LiveDetector- feed a custom stream line-by-line, get anomalies out (powerswatch)..rca(),.ask(...),.save_html(...),.save_rca(...)on any result or live session.
📈 Reporting & benchmarking
- Self-contained HTML report (
--html) - dark-themed dashboard, severity + per-service breakdown, score distribution. Fully offline (no CDN), embeds the RCA narrative. - Speed benchmark (
loglens bench) - lines/sec, time-to-insight, peak RAM across modes. - Reproducible accuracy benchmark (
loglens benchmark) - precision / recall / F1 on labeled data, grid-search, and a--min-f1CI gate. - 100% local & private - detection never leaves your machine; air-gap friendly.
🧭 How it works
- Parse - streaming parser auto-detects the log format.
- Template - messages mined into templates; per-template volume statistics.
- Embed - TF-IDF (fast/turbo) or transformer (deep); one vector per unique template for speed.
- Detect - an ensemble score blends severity prior, template rarity, embedding distance, chronic-pattern damping, and a global-rarity bonus into a calibrated continuous score.
- Group - repeated anomalies collapse into incident families (
×N). - Explain - each anomaly reported with its human-readable reason; optionally an LLM writes the root-cause narrative.
- Deliver - terminal, live
watch, Slack/Teams/Email viainit, or offline HTML report.
🐳 Docker
Multi-arch images (linux/amd64 + linux/arm64) on Docker Hub:
# analyze a file (mount the folder that holds it)
docker run --rm -v "$PWD:/data" loglensai/loglens analyze --source app.log
# live-watch another container (mount the docker socket)
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro \
loglensai/loglens watch "docker logs -f my-api" --rca
Tags: latest, 0.3, 0.3.1 (slim), and deep (adds neural mode).
🗺️ Roadmap
- 🔧 Chronic-noise damping improvements for Linux/Mac daemon logs.
- 📦 Prebuilt GitHub Action for CI log gating.
- 📊 More alert channels - PagerDuty, Opsgenie, generic webhooks.
- 🌐 Optional lightweight web UI for the HTML dashboards.
📜 Honesty notes
- Accuracy measured on Loghub line-level labels (token
-= normal). - Deep mode embeds unique templates only - a real optimization, disclosed.
--rca,ask, and alert cause-hints send only grouped anomaly summaries to the LLM, never the full log.- Alerting works fully offline with built-in cause hints; an LLM key only enriches the narrative.
- All results reproducible with the included harness. See BENCHMARK.md.
🤝 Contributing & support
Issues and PRs welcome. If LogLens AI saves you a 2 a.m. page, please ⭐ star the repo - it genuinely helps.
- 🌐 Website: loglensai.com
- 📦 PyPI: pypi.org/project/loglensai
- 🐳 Docker Hub: hub.docker.com/r/loglensai/loglens
- 📖 Docs: loglensai.com/docs
License
MIT - see LICENSE. Use it in production, commercially, anywhere.
pip install loglensai - your first insight is seconds away.
log anomaly detection · AI log analysis · self-hosted observability · Splunk alternative · Datadog alternative · root-cause analysis · SRE / DevOps · Kubernetes log monitoring · Sentry for logs
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loglensai-0.3.2.tar.gz.
File metadata
- Download URL: loglensai-0.3.2.tar.gz
- Upload date:
- Size: 96.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4f72a3f8d466b1521be13ff47abf5b7f7cf7316053daf3a676ee42e9f35b763
|
|
| MD5 |
9020c114328890c22cd8a66da6aeb680
|
|
| BLAKE2b-256 |
dba647b50d219d29aca83a08a4f4751f72db0af40028c2fb7bd7914167ba9858
|
File details
Details for the file loglensai-0.3.2-py3-none-any.whl.
File metadata
- Download URL: loglensai-0.3.2-py3-none-any.whl
- Upload date:
- Size: 71.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23bf54d468b374004591f07b3663c70ead8e61eaae100fb5440bf2670666b1b5
|
|
| MD5 |
731f84f9335b3225a5afb9bbcf7813a0
|
|
| BLAKE2b-256 |
cb0640bfb7dab3e9762413a2bb0edf90e681537a6b3c3cb31aa81018c5dca109
|