skillfed

splunk-handler

A Python logging handler that sends your logs to Splunk

splunk-handler v3.0.0 1.1M downloads/30d#4,420 on PyPI57
Permissive license MIT License DORMANT released

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

uv

uv add splunk-handler

poetry

poetry add splunk-handler

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: MacOS :: MacOS XOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: System :: Logging

Tags

splunk logging handlersend logs to splunkpython splunk integrationsplunk http event collectorlog aggregation splunksplunk python logger
loggingsplunkobservability

More Logging packages