structlog-sentry
Sentry integration for structlog
What it is and what it does
structlog-sentry is a processor plugin that integrates the Sentry error tracking service with structlog's structured logging framework. It automatically captures log events at configurable severity levels and sends them to Sentry as either breadcrumbs (for lower-severity logs) or full events (for errors and above). The processor sits in structlog's processing pipeline and converts structured log data—including exception info, custom fields, and metadata—into Sentry's event format, with options to tag events, filter specific loggers, and control what context is sent.
You configure it by adding SentryProcessor to your structlog pipeline after the log-level processor, then log normally with structlog; any logs meeting the event_level threshold automatically appear in Sentry. It supports exception capture, custom tags from log fields, breadcrumb filtering, and per-call opt-out via sentry_skip=True. The package is designed for applications already using both structlog and Sentry, eliminating the need to maintain separate instrumentation for each.
Use it for:
- Capture application errors logged via structlog and surface them in Sentry's dashboard without duplicating logging calls.
- Send structured context from logs as Sentry tags and breadcrumbs for better error correlation.
- Automatically report exceptions with sys.exc_info() to Sentry when you call log.error() in exception handlers.
- Filter out noisy loggers or skip Sentry reporting for specific log calls while keeping them in local logs.
- Integrate structlog JSON output with Sentry for centralized error tracking in monitoring stacks.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Bridges structlog and Sentry to automatically capture structured logs as Sentry events and breadcrumbs, with configurable thresholds and filtering.
Yes, if you already use both structlog and Sentry. It eliminates boilerplate and keeps error tracking in sync with your structured logging. The low install friction and permissive license make it a straightforward addition. Dormant maintenance is a minor concern—the package is stable and the last commit is recent—but monitor for breaking changes in structlog or sentry-sdk if you adopt it for a new project.
Install
structlog-sentry on PyPI
pip
pip install structlog-sentryuv
uv add structlog-sentrypoetry
poetry add structlog-sentryInstalling structlog-sentry
Before you install
Low friction: pure Python wheel with only two runtime dependencies (sentry-sdk and structlog). Maintenance is dormant—last release was 640 days ago, but the repo remains active with a recent commit on 2025-02-18 and no archived status.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install structlog-sentry
import logging
import sentry_sdk
import structlog
from structlog_sentry import SentryProcessor
sentry_sdk.init()
structlog.configure(
processors=[
structlog.stdlib.add_log_level,
SentryProcessor(event_level=logging.ERROR),
],
logger_factory=structlog.stdlib.LoggerFactory(),
wrapper_class=structlog.stdlib.BoundLogger,
)
log = structlog.get_logger()
log.error("error message")
Requires structlog and sentry-sdk to be installed; SentryProcessor must be placed after add_log_level in the processor chain.
Verify before relying
- Whether dormant maintenance (640 days since release) poses a risk for future Python or dependency updates.
- Performance impact of automatic Sentry event capture on high-volume logging workloads.
- Whether custom fields passed to log calls are reliably sent as Sentry context or tags.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4.0,>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — sentry-sdk, structlog |
| Maintenance | dormant — 640 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,431,244/month — #2,303 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: structlog_sentry-2.2.1-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
django-structlogIntegrates structured logging into Django…
permissive · top 5,000 on PyPI
eliotEliot is a structured logging system that…
permissive · top 15,000 on PyPI
structlog-gcpConfigures structlog to output logs in Google…
unclear · top 15,000 on PyPI
structlog-prettyAdds structlog processors that format log…
permissive · top 15,000 on PyPI
pytest-structlogProvides a pytest fixture for capturing and…
permissive · top 15,000 on PyPI
structlogstructlog is a structured logging library that…
permissive · top 1,000 on PyPI
macwinnie-enhanced-loggingProvides a batteries-included logging setup…
unclear · top 15,000 on PyPI
sentry-sdkSentry SDK captures and reports Python…
permissive · top 1,000 on PyPI
sentry-cliA command-line tool for interacting with…
permissive · top 15,000 on PyPI
ravenRaven is a legacy Python client for Sentry that…
permissive · top 5,000 on PyPI