logsite
Your logs say something broke. logsite tells you which line of your code, and writes a test that proves it.
pip install logsite
Point it at your code and the logs you already have (a log file, Loki, OpenSearch / Elasticsearch or CloudWatch). It turns thousands of stack traces into a few causes, each pointing at your line of code. No SDK, nothing to add to your services. Python, Java, Go, TypeScript and JavaScript.
How is this different from Sentry, Datadog or Grafana?
It needs no SDK and works on the logs you already have. Sentry and Datadog see errors from services you've instrumented, inside their platform. Grafana and Loki store and search your logs, but don't know your code. logsite reads both your logs and your code, on your machine:
| logsite | Sentry, Datadog | |
|---|---|---|
| Setup | point it at a log file or your log store | an SDK or agent in every service |
| Where it runs | your machine or CI; no logs leave it | their cloud |
| Knows your code | yes: maps each error to the line at your commit, even after the code moved | through the stack trace and a source integration |
| Output | causes, the line, and a failing test checked to fail the way production did | an issue page |
| Price | free, Apache 2.0 | per event or GB |
It doesn't replace them: there's no hosted UI or real-time alerting of its own. It works alongside them, and plugs into Grafana as a data source and into Grafana alerts.
Try it in 2 minutes
The repo has a small demo shop, examples/bookstore, with a planted bug: calls to a
supplier time out and are never retried. Its production log is in the repo too.
pip install logsite pytest
git clone https://github.com/rajpaynaik/logsite && cd logsite/examples/bookstore
1. What's failing? Read the log and group the errors by cause:
$ logsite errors --from ../../bench/repro/scenarios/supplier-timeout/incident.log
28 errors in incident.log · 2 group(s)
# TREND COUNT ERROR RAISED AT LOGGED AT
1 25 TimeoutError: timed out supplier.py:31 api.py:36
2 3 ConnectionRefusedError: cache unavailable cache.py:15 api.py:23
━━ 1. TimeoutError: timed out ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 25
Raised at bookstore/supplier.py:31 restock() (in socket)
31 │ with urllib.request.urlopen(request, timeout=self.timeout) as resp:
Logged at bookstore/api.py:36
Call path api.handle › api.<lambda> › inventory.reorder › supplier.restock › socket
28 errors, 2 causes, and the exact line behind each one.
2. Turn the error into a failing test. logsite takes the function to call, the values the failing request logged and the dependency to fake, and writes a pytest test:
$ logsite repro --from ../../bench/repro/scenarios/supplier-timeout/incident.log --write-test
Reproduce 346fa937 · TimeoutError: timed out · 25 error(s)
Fail with TimeoutError through bookstore/supplier.py:31 (restock)
Call reorder(sku, qty) from bookstore.inventory bookstore/inventory.py:13
Fake bookstore/supplier.py:31 calls urllib.request.urlopen(…): patch urllib.request.urlopen raise TimeoutError
Inputs sku = BK-1802 logged at bookstore/inventory.py:17
qty = 10 logged at bookstore/inventory.py:17
wrote tests/test_repro_346fa937.py
3. Check it fails the way production did: the same exception, through the same line.
$ logsite agent --expect 346fa937 -- python -m pytest tests/test_repro_346fa937.py
✓ 346fa937 reproduced: TimeoutError through bookstore/supplier.py:31, as in production
Now fix supplier.py until the test passes. Run your tests through logsite agent to get
the causes instead of hundreds of lines of output:
$ logsite agent -- python -m pytest
pytest: 1 failed, 6 passed · 1 cause(s) · exit 1
1. 1 test(s) TimeoutError: timed out
raised bookstore/supplier.py:31 in restock()
Use it on your own service
cd your-service
logsite lint # logging mistakes in your code; no logs needed
logsite errors --from downloaded.log # errors grouped by cause, from any log file
To read from your log store, add a logsite.toml:
[backend]
type = "loki" # or "opensearch", "cloudwatch", "file"
url = "http://localhost:3100"
selector = '{service_name="checkout"}'
logsite errors # production errors from the last 24h, grouped by cause
logsite investigate # linked into incidents, with the deploy and commit behind them
logsite about app/checkout.py:42 # what production says about this line, before you change it
See Configuration for every backend.
What else it does
- Finds the change behind an incident:
logsite investigatenames the deploy and the commits just before the errors started. → Errors and incidents - Remembers past fixes: when an old error comes back, it shows the commit that fixed it last time. → History
- Opens a pull request per new error: a GitHub Action reads your logs on a schedule and opens a draft pull request with the reproduction test.
- Blocks bad releases in CI:
logsite errors --since-deploy $TAG --fail-on-newfails the build if the release brought a new error. - Helps AI coding assistants: the Claude Code plugin
and the MCP server tell the assistant what a function
does in production before it changes it.
/logsite:fix-errorreproduces an error, then fixes it. - Shows production in your editor: how often each log call runs and which lines raise errors, right above the code. VS Code, or any LSP editor.
- Cuts log costs: which
logger.info(...)calls make up your log bill, and secrets that reached your logs. → Cost and leaks - Works with Grafana: a data source, dashboards, alert summaries and Alloy rules to drop noisy lines. → Grafana
Supported
| Languages | Python (logging, structlog, loguru), Java (SLF4J, Log4j 2, java.util.logging, Lombok), Go (slog, zap, zerolog, logrus, logr, klog), TypeScript and JavaScript (console, pino, winston, bunyan, NestJS) |
| Log stores | Log files, Loki, OpenSearch / Elasticsearch, CloudWatch Logs, OpenTelemetry (OTLP JSON from the Collector), Sentry |
| Tests and builds | pytest, go test, Maven, Gradle, Jest, Vitest, tsc, javac, gcc-style compilers |
| Editors | VS Code; Neovim, JetBrains, Helix, Zed through LSP |
| AI assistants | Claude Code plugin; any MCP client (Claude Desktop, Cursor, …) |
Install
pip install logsite # the command-line tool
pip install "logsite[lsp,mcp]" # + the editor language server and the MCP server
Documentation
Commands · Configuration · Errors and incidents · Agent mode · Reproduce an error · GitHub Action · History · Grafana · Languages · OpenTelemetry · Sentry · Lint rules · Cost and leaks · Request timeline · MCP server · Claude Code plugin · How it works · Data flow and security · Roadmap
Status
Early (0.x): feedback and contributors welcome. Questions and ideas go in
Discussions; see the
changelog for what's new. Formerly loglens: loglens.toml and
[tool.loglens] configs keep working. See CONTRIBUTING.md;
a new log backend is a good first PR.
License
Apache License 2.0. See LICENSE.
Metadata
Release files for logsite 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| logsite-0.4.1.tar.gz | 1.3 MB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| logsite-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.5 MB
Release files / logsite-0.4.1.tar.gz
| Download URL | logsite-0.4.1.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
682e5bb4284508573f74e03a99d68c60f7d05414b007771e8aa5fb913d674c6c
|
|
BLAKE2b-256 checksum How to use checksums |
c1f407982b7198049ed5337c997b1ca96cbc1de8b42bfaa8379c4555dea65c01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logRelease files / logsite-0.4.1-py3-none-any.whl
| Download URL | logsite-0.4.1-py3-none-any.whl |
|---|---|
| Size | 217.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35dbbc7251ba9a94829154794e3bced5d012d12961efd6760ef8fd900922a7d0
|
|
BLAKE2b-256 checksum How to use checksums |
7fa982d08b8026fed37448fe63b772e73259a348e1643b4ed2ff983baf18c2e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logSecurity for logsite 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for logsite-0.4.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.