splunkhecwriter
A small Python client for sending JSON events to Splunk HTTP Event Collector (HEC). Requires Python 3.11 or newer.
Usage
from splunkhecwriter import SplunkHECWriter
with SplunkHECWriter(
splunk_host="splunk.example.com",
splunk_hec_token="<HEC-TOKEN>",
sourcetype="my_app:json",
timeout=(5, 30), # connection and response timeout, in seconds
) as writer:
writer.send_msg({"message": "service started", "severity": "INFO"})
# Batches are sent as newline-delimited JSON event envelopes.
writer.send_msgs(msgs=[{"message": "one"}, {"message": "two"}], limit=100)
TLS certificate verification is enabled by default. Keep it enabled in production;
configure a trusted certificate on Splunk instead of disabling verification.
Optional event_time arguments are Unix timestamps. When omitted, Splunk applies
its configured timestamp extraction and fallback behavior.
The client retries network failures and transient HTTP responses up to three times
by default, with exponential backoff. A timed-out POST might already have reached
Splunk, so retrying can result in duplicate events. Set max_retries=0 to disable
retries when that tradeoff is unsuitable. Failed requests raise SplunkHECError;
the underlying requests.Session can also be managed with close() or a with
statement.
Development
The package supports Python 3.11 and newer. CI checks the currently supported Python releases.
Use uv to set up the development environment and run linting:
uv sync --locked --group dev
uv run --locked pylint src/splunkhecwriter
License
This project is licensed under the Apache License; see LICENSE.md.
Disclaimer
This project is neither affiliated with nor endorsed by Splunk.
Metadata
Release files for splunkhecwriter 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| splunkhecwriter-0.5.0.tar.gz | 9.4 kB | With provenance | Details for splunkhecwriter-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| splunkhecwriter-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for splunkhecwriter-0.5.0-py3-none-any.whl |
Total release size: 19.2 kB
Release files / splunkhecwriter-0.5.0.tar.gz
| Download URL | splunkhecwriter-0.5.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e32f4855a4dfc6023becc9f2fa7d2487a1feb60164ae7e700183946f77708f9
|
|
BLAKE2b-256 checksum How to use checksums |
648472c08f9845dce425372bc1008cbd8985c85b78228ec7083c9fad59e5c982
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / splunkhecwriter-0.5.0-py3-none-any.whl
| Download URL | splunkhecwriter-0.5.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23692b23aef1da71cc3369bfa2db6a0e43c48cfb12300eea8984bb3c589aa954
|
|
BLAKE2b-256 checksum How to use checksums |
5fa06c72e371a79c4c6fd622b374530fd02611ec9cd006cafa01872acc205218
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for splunkhecwriter 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for splunkhecwriter-0.5.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.