Overview
OpenSRE queries Splunk over the REST API. When you ask about logs, the agent writes an SPLquery and calls query_splunk_logs.
There is no opensre integrations setup splunk handler today. Configure
Splunk via 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: Environment variables
Option 2: 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
query_splunk_logs, and surfaces the seeded
connection refused to billing-api event from this exact local instance.
Teardown:
Tools
query_splunk_logs
The agent writes the SPL
query and calls the tool. OpenSRE does not
build SPL from a fixed priority table.
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.