Splunk
The Splunk backend is ingest-only, and sends logs to Splunk via the HTTP Event Collector (HEC) API.
Behaviour and configurations
Configuration
The backend can be configured with the following options:
:url(string, required) - The full HEC endpoint URL.:token(string, required) - The token authorizing the ingest.:index(string, optional) - The target index. It must be in the list of indexes allowed by the HEC token, otherwise Splunk rejects the events. Defaults to the token's index.:source(string, optional) - The eventsource. Defaults to the Logflare source name.:sourcetype(string, optional) - The eventsourcetype. Defaults to_json, so that Splunk extracts the fields of the log event.:host(string, optional) - The eventhost. Defaults to the HEC input setting.
Obtaining the configuration values
- In Splunk Web, go to Settings → Data inputs → HTTP Event Collector and select New Token.
- Name the token, optionally select the allowed indexes, and save it. Copy the generated token value into
:token. - Make sure the HEC is enabled under Global Settings, and note the listening port (
8088by default). - The endpoint URL is
https://<your-splunk-host>:8088/services/collector/eventfor Splunk Enterprise, andhttps://http-inputs-<stack>.splunkcloud.com/services/collector/eventfor Splunk Cloud Platform, where<stack>is the name in your Splunk Cloud URL.
Implementation Details
- Log events are sent as a JSON array of HEC event objects, with the log event body under the
eventkey and the log event timestamp under thetimekey. - Requests are gzip compressed.
- Authentication uses the
Authorization: Splunk <token>header. - Testing the connection sends an empty payload, which Splunk answers with a
No dataerror. This verifies both reachability and the token. - URLs pointing at private or reserved IP addresses are rejected.