--- id: splunk-handler version: "3.0.0" license: MIT License license_treatment: permissive maintenance: dormant --- # splunk-handler — A Python logging handler that sends your logs to Splunk License: permissive · Maintenance: dormant · Downloads: 1.1M/mo ## 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 above — 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 pip install splunk-handler uv add splunk-handler 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: unspecified - Install friction: low - Maintenance: dormant - Downloads: 1.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags splunk logging handler, send logs to splunk, python splunk integration, splunk http event collector, log aggregation splunk, splunk python logger, logging, splunk, observability [View on SkillFed](https://skillfed.io/packages/splunk-handler) · [View on PyPI](https://pypi.org/project/splunk-handler/)