Registry / observability / splunk-hec-handler

splunk-hec-handler

JSON →
library1.2.0pypypi✓ verified 84d ago

A Python logging handler that sends logs to Splunk via HTTP Event Collector (HEC). Current version 1.2.0, maintained on GitHub with occasional updates.

pip install splunk-hec-handler
INSTALL
IMPORT
SIG · SPLUNK-HEC-HANDLER
S
splunk-hec-handler
observabilitypythonv1.2.0
Install
2.1s avg
Import
558ms
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.588s · 21MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.528s · 21MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SplunkHecHandler
from splunk_hec_handler import SplunkHecHandler
SplunkHecHandler
from splunk_hec_handler import SplunkHecHandler
import SplunkHecHandler
Incorrect: leads to ModuleNotFoundError

Basic setup: create handler with HEC URL and token, add to logger, log a test message.

import logging from splunk_hec_handler import SplunkHecHandler logger = logging.getLogger('splunk') logger.setLevel(logging.DEBUG) handler = SplunkHecHandler( 'https://splunkhec.example.com', token='your-hec-token', source='python', sourcetype='json', index='main' ) logger.addHandler(handler) logger.info('Test message')
Debug
Known issues
gotchaThe handler uses HTTP POST by default. If your Splunk HEC endpoint uses HTTPS with a self-signed certificate, you must set verify=False or provide a CA bundle.
fix
Initialize handler with verify=False (not recommended for production) or pass a valid cert path.
affects: >=1.0.0
gotchaThe handler silently drops logs if HEC token is invalid or endpoint unreachable, unless you add a custom error handler.
fix
Add a custom error handler via logging.Handler.handleError or monitor your Splunk HEC endpoint for 401/403 errors.
affects: >=1.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'splunk_hec_handler'
Package not installed or import name misspelled (underscore vs hyphen). Correct import is 'splunk_hec_handler' (underscores).
fix
Install with 'pip install splunk-hec-handler' and import with 'from splunk_hec_handler import SplunkHecHandler'.
AttributeError: module 'splunk_hec_handler' has no attribute 'SplunkHecHandler'
Incorrect import style (e.g., import splunk_hec_handler then splunk_hec_handler.SplunkHecHandler should work; but if using old version or typo, fails).
fix
Use 'from splunk_hec_handler import SplunkHecHandler'.
Upgrade
Version history
1.2.0latest on PyPI · released Feb 16, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources
splunk-hec-handler — pip install splunk-hec-handler · libregistry