Skip to main content

Module splunk_hec_logging

Module splunk_hec_logging 

Source
Expand description

The splunk-hec-logging node โ€” ships access logs to a Splunk HTTP Event Collector (HEC) in batches.

Ports the APISIX splunk-hec-logging plugin onto featherbitโ€™s shared BatchSink. Each request builds a log entry, wraps it in a Splunk HEC event envelope ({time, source, sourcetype, event}), and hands it to the sink with a non-blocking push; a background task POSTs the concatenated events to the HEC uri with an Authorization: Splunk <token> header. The node never mutates the request/response and never fails, so it belongs in the response pipeline, after the upstream node.

Structsยง

SplunkFlusher ๐Ÿ”’
Delivers batches by POSTing HEC events to the Splunk endpoint.
SplunkHecLoggingPlugin
Batches access-log entries and POSTs them to a Splunk HEC endpoint.

Constantsยง

DEFAULT_SOURCE ๐Ÿ”’
DEFAULT_SOURCETYPE ๐Ÿ”’

Functionsยง

build_splunk_body ๐Ÿ”’
Serializes a batch into the HEC request body: HEC accepts multiple JSON event objects concatenated with no separator. Factored out for unit testing.
wrap_event ๐Ÿ”’
Wraps one log entry in a Splunk HEC event envelope with a shared timestamp.