Overview
OpenSRE queries Splunk over the REST API during investigations. The agent callsquery_splunk_logs with a planner-supplied SPL query.
There is no opensre integrations setup splunk handler today. Configure
Splunk via the onboarding wizard, environment variables, or the integration
store, then verify with opensre integrations verify splunk.
Prerequisites
- Splunk Enterprise or Splunk Cloud (version 8.x or later)
- REST API access on port 8089
- A bearer token with search capability (see Credentials)
Setup
Option 1: Onboarding wizard
.env).
Option 2: Environment variables
Option 3: Persistent store
Option 4: Multi-instance
SPLUNK_INSTANCES is set it overrides the single-instance SPLUNK_URL /
SPLUNK_TOKEN variables.
Credentials
OpenSRE uses bearer tokens — not basic auth and not HEC tokens. Via the Splunk UI:- Go to Settings → Tokens
- Click New Token
- In User, pick the existing Splunk user the token authenticates as
- Fill in Audience (required) and an expiry date
- Copy the generated token
<PASSWORD> with your admin password and
<SPLUNK_USER> with the service account the token should authenticate as):
search capability. The admin role includes this by
default. For a dedicated service account, ensure the role includes:
searchread_splunkd_private_settings(needed for the verify call against/services/server/info)
Quick local test with Docker
opensre investigate --print-template splunk prints this payload shape if you want to start from it:
Investigation tools
query_splunk_logs
The investigation planner writes the SPL
query and calls the tool. OpenSRE
does not build SPL from a fixed priority table.
When alert_source is splunk, OpenSRE auto-seeds the Splunk tool source
before the ReAct loop. Seed calls use integration defaults if the planner has
not supplied a query yet.
Verify
Troubleshooting
Security
- Use a read-only bearer token — never use an admin token in production.
- Store
SPLUNK_TOKENin.envor the credential store, not in source code or CI logs. - Prefer a dedicated
opensreservice account with only thesearchcapability (plusread_splunkd_private_settingsfor verify). - For enterprise self-signed certificates, set
SPLUNK_CA_BUNDLErather than disabling verification entirely. - Set
SPLUNK_VERIFY_SSL=falseonly in local or dev environments when you cannot supply a CA bundle. - Rotate tokens on a schedule and revoke them when no longer needed.
Extras
Alert annotations as planner context
Putting a ready-made SPL string in the alert helps the planner. The built-in Splunk alert template includescommonAnnotations.splunk_query. The annotation
is agent context (visible in the alert payload) — it is not executed by a
separate deterministic builder.
Sample alert template
There is noopensre investigate --template splunk. Use one of:
Then edit the printed JSON and pass it with
opensre investigate --input-json '…'
or /investigate path/to/alert.json if you want a file-based run.