Skip to main content

logsite

PyPI Python VS Code CI License: Apache 2.0

Your logs say something broke. logsite tells you which line of your code, and writes a test that proves it.

pip install logsite

64,580 log lines in, 4 causes out with the file and line of each, then a failing test that reproduces the new one

Point it at your code and the logs you already have (Loki, OpenSearch / Elasticsearch, CloudWatch, Sentry, OpenTelemetry or a file). It turns thousands of stack traces into a few causes, each pointing at your line of code, and keeps every error in your own database, so "what failed last Tuesday between 2 and 4pm?" is an instant query instead of a log scan. 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()

Prefer a browser?

logsite app

Connect your log store, Slack and a database in a few forms, each with a test button, then see your production errors grouped by cause, with the line of code and a button that writes the failing test. More.

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 investigate names 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
  • An error index for your logs: errors are grouped and stored as they arrive, so "last Tuesday, 2 to 4pm" is an instant query instead of a Loki scan, in the app, in SQL, or in a Grafana dashboard on the store. logsite db backfill loads your history.
  • Watches production and posts to Slack: logsite watch checks your logs every few minutes, stores every error in your own Postgres (or SQLite) for later analysis, and posts new errors, regressions and spikes to Slack.
  • 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-new fails 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-error reproduces 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 · Watch production · logsite app · 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.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logsite 0.5.0
File Size Uploaded Provenance
logsite-0.5.0.tar.gz 1.4 MB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for logsite 0.5.0
File Interpreter ABI Platform
logsite-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / logsite-0.5.0.tar.gz

Download URL logsite-0.5.0.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
139d41e05529644ccf93b77e3137a75859c08889095213f37dec0c1f04536064
BLAKE2b-256 checksum
How to use checksums
2e297fb40cd555b6e2202b1287755b33cd0c1e1988a767c6bc3f1e6c6741e21c
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 24, 2026.

Transparency log

Release files / logsite-0.5.0-py3-none-any.whl

Download URL logsite-0.5.0-py3-none-any.whl
Size 261.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b992d0bd55958ab3e7059199da705ce3e906f49cd4a99e75355fc68fbc47def1
BLAKE2b-256 checksum
How to use checksums
0f97a468a66ce8c90c0976af3c69a0db25456b32cedabe61b017a08e7c01ab32
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 24, 2026.

Transparency log

Security for logsite 0.5.0

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.

Select from 2 files

Attestation for logsite-0.5.0.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 24, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page