splunk-handler
A Python logging handler that sends your logs to Splunk
What it is and what it does
Splunk Handler is a Python logging handler that integrates with Python's standard logging framework to forward log records to a Splunk Enterprise server. It uses Splunk's HTTP Event Collector (HEC) API to send events asynchronously, with configurable batching, retry logic, and queue management. The handler wraps requests to communicate with Splunk and supports optional JSON formatting, proxy configuration, SSL verification control, and per-record parameter overrides.
The package is designed for applications that already run Splunk and need to push application logs into it without building custom HTTP clients. It handles threading concerns (with special support for AWS Lambda via a force_flush function), queue overflow strategies, and connection retries with backoff. Configuration can be done programmatically, via Python's logging.config.dictConfig, or via logging config files.
Use it for:
- Forward application logs from a Python service to a centralized Splunk instance for monitoring and search.
- Integrate Splunk logging into a Django or Flask application using logging.config.dictConfig.
- Send Lambda function logs to Splunk by calling force_flush() at the end of the handler to ensure all queued events are delivered before execution halts.
- Batch and retry log delivery to Splunk with configurable backoff and queue size limits to handle network failures gracefully.
- Route logs to Splunk with custom source, sourcetype, and index values per log record or globally.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Python logging handler that sends log events to a Splunk Enterprise server via its HTTP Event Collector API.
Yes, if you run Splunk Enterprise and need a straightforward Python logging integration. The package is stable and low-friction to install. However, be aware it is dormant (last release 2021-08-17)—use it for established, low-change deployments. If you need active maintenance or support for very recent Python versions, evaluate whether your Splunk version offers a newer official SDK or consider maintaining a fork.
Install
splunk-handler on PyPI
pip
pip install splunk-handleruv
uv add splunk-handlerpoetry
poetry add splunk-handlerInstalling splunk-handler
Before you install
Low install friction with a single runtime dependency (requests). Maintenance is dormant—last release was 2021-08-17—so expect no active bug fixes or feature updates, though the codebase remains stable for existing use.
License in practice
MIT License (permissive) allows free use, modification, and distribution with minimal restrictions, making it safe to adopt in most projects.
Quickstart
pip install splunk_handler
from splunk_handler import SplunkHandler
import logging
splunk = SplunkHandler(
host='splunk.example.com',
port='8088',
token='YOUR_HEC_TOKEN',
index='main'
)
logging.getLogger('').addHandler(splunk)
logging.warning('hello!')
Requires a Splunk Enterprise server with HTTP Event Collector (HEC) enabled and configured; you must provide a valid HEC token and host/port.
Verify before relying
- Whether the package works reliably with Python versions beyond 3.9 (classifiers list 3.6–3.9 but latest release is from 2021).
- Current compatibility with modern versions of the requests library and urllib3 retry logic.
Package facts
| License | MIT License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — requests |
| Maintenance | dormant — 1,823 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,060,012/month — #4,420 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: splunk_handler-3.0.0-py2.py3-none-any.whl
Tags
More Logging packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
python-json-loggerFormats Python logging output as JSON, making…
permissive · top 1,000 on PyPI
structlogstructlog is a structured logging library that…
permissive · top 1,000 on PyPI
loguruLoguru provides a pre-configured logger that…
permissive · top 1,000 on PyPI
coloredlogsAdds colored output to Python's standard…
permissive · top 1,000 on PyPI
wandbwandb is a machine learning experiment tracking…
permissive · top 1,000 on PyPI
logzio-python-handlerA Python logging handler that sends logs in…
permissive · top 5,000 on PyPI
splunk-hec-handlerIntegrates Python logging with Splunk's HTTP…
permissive · top 15,000 on PyPI
splunk-sdkProvides a Python client library for…
permissive · top 5,000 on PyPI
fluent-loggerSends structured event logs from Python…
unclear · top 5,000 on PyPI
cloudwatchA Python logging handler that sends log events…
permissive · top 15,000 on PyPI
logging-azure-restProvides a Python logging handler that…
permissive · top 5,000 on PyPI
splunk-opentelemetryAutomatically instruments Python applications…
permissive · top 15,000 on PyPI
logging-jsonFormats Python logging records as JSON output,…
permissive · top 15,000 on PyPI
loki-logger-handlerA logging handler that sends Python log…
permissive · top 15,000 on PyPI
signalflow-client-pythonA Python client library that connects to Splunk…
permissive · top 15,000 on PyPI