skillfed

structlog-sentry

Sentry integration for structlog

structlog-sentry v2.2.1 4.4M downloads/30d#2,303 on PyPI139
Permissive license MIT DORMANT released

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-sentry

uv

uv add structlog-sentry

poetry

poetry add structlog-sentry

Installing 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

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

structlog sentry integrationsend structured logs to sentrysentry error tracking with structlogstructlog processor sentrystructured logging error monitoringsentry breadcrumbs from logslog aggregation sentry
error-trackingstructured-logging

More Python Modules packages