Skip to main content

Overview

OpenSRE queries Splunk over the REST API during investigations. The agent calls query_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

Select Splunk under Observability and provide the REST API base URL and bearer token. The wizard validates and writes the integration store (token stays in the credential store; URL/index/SSL settings sync to .env).

Option 2: Environment variables

Option 3: Persistent store

Option 4: Multi-instance

When 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:
  1. Go to SettingsTokens
  2. Click New Token
  3. In User, pick the existing Splunk user the token authenticates as
  4. Fill in Audience (required) and an expiry date
  5. Copy the generated token
Via the REST API (replace <PASSWORD> with your admin password and <SPLUNK_USER> with the service account the token should authenticate as):
name is the existing Splunk user the token authenticates as, not an arbitrary label — Splunk rejects an unrecognized name with User "..." does not exist. The token inherits that user’s roles, so point it at a least-privilege service account rather than admin. audience is also required (a short free-text description of the token’s purpose); omitting it fails with The following required arguments are missing: audience.
The token needs the search capability. The admin role includes this by default. For a dedicated service account, ensure the role includes:
  • search
  • read_splunkd_private_settings (needed for the verify call against /services/server/info)

Quick local test with Docker

splunk/splunk publishes amd64 only, which is why --platform linux/amd64 is already on the command above. On Apple Silicon it runs under emulation and can take 15 minutes or more to report ready; on native amd64 the flag is a harmless no-op. Without SPLUNK_GENERAL_TERMS=--accept-sgt-current-at-splunk-com alongside SPLUNK_START_ARGS=--accept-license, the container exits immediately with License not accepted — newer images require both, not just the license flag documented in older Splunk Docker guides.
Seed a test event and create a token:
Then point OpenSRE at an empty store, so the container is the only Splunk either command can reach:
Do this before verifying, and keep it for the rest of the recipe. A saved Splunk record wins over SPLUNK_URL / SPLUNK_TOKEN for opensre integrations verify, so with your real store in play the check can pass against production while appearing to test localhost — the SOURCE column reads local store instead of local env. opensre investigate fails the other way: it only falls through to env vars when the store has no records at all, so a single record for any unrelated service blocks env resolution entirely. An empty store is the one state both commands agree on. SPLUNK_INSTANCES overrides SPLUNK_URL / SPLUNK_TOKEN outright, which is why the block above clears it.
Verify:
Trigger a real investigation against the seeded event. opensre investigate --print-template splunk prints this payload shape if you want to start from it:
Real output from a run against this exact local instance (edited for length). Other integrations still resolved from your own environment ride along harmlessly:
Teardown:

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

Expected output:

Troubleshooting

Security

  • Use a read-only bearer token — never use an admin token in production.
  • Store SPLUNK_TOKEN in .env or the credential store, not in source code or CI logs.
  • Prefer a dedicated opensre service account with only the search capability (plus read_splunkd_private_settings for verify).
  • For enterprise self-signed certificates, set SPLUNK_CA_BUNDLE rather than disabling verification entirely.
  • Set SPLUNK_VERIFY_SSL=false only 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 includes commonAnnotations.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 no opensre 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.