Skip to main content

splunkctl — operate Splunk Enterprise and Splunk SOAR as code

splunkctl

PyPI Python CI License

Operate Splunk Enterprise and Splunk SOAR as code with a safety-first CLI and MCP server for humans and AI agents.

Documentation · Command catalog · Releases


splunkctl is an open-source Python CLI and Model Context Protocol (MCP) server for remote Splunk Enterprise and Splunk SOAR instances. Use it interactively, script its stable JSON output, or give an MCP client access to the same command surface.

  • Manage Splunk Enterprise — searches, detection rules, alerts, indexes, inputs, lookups, parsers, dashboards, apps, users, topology, audit, and Enterprise Security workflows.
  • Operate Splunk SOAR — containers, artifacts, playbooks, actions, cases, approvals, assets, vault files, custom lists, administration, and SIEM-to-SOAR ingest.
  • Keep configuration as code — pull live state, review structured drift, and push approved changes with change-evidence reports.
  • Automate safely — mutations preview by default, machine output is structured, errors are typed, and every target profile and host is shown.

Every mutation is a dry run by default. Nothing changes until you pass --yes. Review the target and proposed change before applying it.

Install

python -m pip install splunkctl

Python 3.13 or newer is required. Core commands work with the upstream Splunk SDK installed from PyPI.

Dashboard, lookup-file, and HTTP Event Collector (HEC) token commands use entity classes provided by the optional splunkctl SDK fork:

python -m pip install git+https://github.com/dannyota/splunk-sdk-python@splunkctl

See the installation guide for environment-specific setup.

Quickstart

# Configure and verify Splunk Enterprise
splunkctl config init
splunkctl doctor

# Read live state
splunkctl info
splunkctl search run 'index=main | head 10'
splunkctl rules list --json

# Preview a change; add --yes only after reviewing it
splunkctl rules disable 'My Rule'

# Add and verify Splunk SOAR when needed
splunkctl config init --soar
splunkctl soar test
splunkctl auth login --target siem             # browser SAML/MFA login
splunkctl soar containers list

Use named profiles for separate development, UAT, and production instances:

splunkctl config init --profile uat
splunkctl --profile uat doctor
splunkctl --profile uat rules list

Core workflows

Configuration as code

The state engine covers rules, parsers, macros, lookups, and selected SOAR objects. Dashboards support pull and diff. Push never deletes remote objects.

splunkctl state pull --dir config/
# Edit the exported files in version control.
splunkctl state diff --dir config/
splunkctl state push --dir config/ --report change-report.json
splunkctl state push --dir config/ --report change-report.json --yes

The report records before-and-after state and whether the change was applied, so it can be attached to a change ticket.

Detection and SIEM operations

splunkctl rules export --path rules.yaml
splunkctl rules import --path rules.yaml
splunkctl datamodels acceleration
splunkctl es notables list --status new --json
splunkctl audit rbac --format csv --out rbac.csv
splunkctl server cluster

Enterprise Security commands detect whether the required app is available and return a clear error when it is not.

Splunk SOAR operations

splunkctl soar containers list --severity high
splunkctl soar playbooks export my_playbook --unpack --out playbooks/
splunkctl soar playbooks run my_playbook --container 42 --wait
splunkctl soar actions run --action geolocate_ip --asset maxmind \
  --container 42 --param ip=203.0.113.10 --wait
splunkctl soar ingest --spl 'index=notable' --label events

SOAR commands use the same profiles, dry-run guard, output formats, and error contract as the Splunk Enterprise commands.

MCP for AI agents

splunkctl mcp install
splunkctl mcp serve

The built-in MCP server generates typed tools from the CLI command tree and uses progressive discovery: clients start with a small set of meta-tools, then focus on the command groups needed for the task. Guarded tools require an explicit yes=true before they can mutate a remote instance.

See the MCP guide for stdio and streamable HTTP configuration.

Command groups

Group Purpose
doctor Check connection, authentication, health, and permissions
config Configure profiles and test connectivity
auth Browser SAML login, session status, and logout
info Show server version, operating system, and license details
search Run, export, upload, and manage search jobs
rules Manage detection rules and YAML import/export
alerts Inspect fired alerts and manage suppression
dashboards Manage Classic and Studio dashboards
indexes Manage indexes
inputs Manage monitor, TCP, UDP, script, and HTTP inputs
lookups Manage lookup files, definitions, and automatic wiring
hec Manage HEC tokens, settings, and events
parsers Manage source types, props, transforms, and YAML state
apps Install, update, reload, and uninstall apps
users Manage users and roles
server Inspect health, topology, deployment, auth, tokens, and workloads
es Triage notables and manage correlations and threat intelligence
audit Review changes and generate role-based access control attestations
kvstore Manage KV Store collections and documents
conf Edit any Splunk configuration file and stanza
macros, eventtypes, tags Manage search knowledge objects
datamodels Inspect definitions and acceleration health
state Pull, diff, and push configuration state
soar Operate Splunk SOAR and run SIEM-to-SOAR workflows
commands Emit the machine-readable command tree
completion Generate shell completion for Bash, Zsh, or Fish
mcp Install and run the MCP server

Run splunkctl COMMAND --help for local help, or use the generated command reference.

Output and safety contracts

Global flags work before or after subcommands:

--json              Force JSON output
--format FMT        Select table, json, csv, or jsonl
--fields f1,f2      Select output fields
--out FILE          Write output to a file
--yes, -y           Apply a mutation after previewing it
--timeout N         Set the request timeout in seconds
--watch N           Repeat a read-only command every N seconds
--config FILE       Use a specific configuration file
--profile NAME      Select a named profile
--debug             Log HTTP requests and responses

Under JSON output, failures emit one JSON object on standard error with a stable error kind:

{"error": {"kind": "not_found", "http_status": 404, "message": "..."}}

Kinds include auth, permission, not_found, conflict, http, connection, timeout, and error. List commands share uniform filtering and paging flags where the remote API supports them.

Every guarded operation identifies its target before it runs:

$ splunkctl --profile uat rules delete 'My Rule'
[DRY RUN] Delete saved search 'My Rule' (profile: uat @ uat.splunk.internal:8089)
Pass --yes to apply.

Development

git clone https://github.com/dannyota/splunkctl
cd splunkctl
python -m pip install -e '.[dev]'
python -m pytest

License

Apache-2.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

splunkctl-0.13.0.tar.gz (246.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

splunkctl-0.13.0-py3-none-any.whl (321.1 kB view details)

Uploaded Python 3

File details

Details for the file splunkctl-0.13.0.tar.gz.

File metadata

  • Download URL: splunkctl-0.13.0.tar.gz
  • Upload date:
  • Size: 246.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for splunkctl-0.13.0.tar.gz
Algorithm Hash digest
SHA256 8a3ca2b5b1a12fa9315c192c992dcbb7adc7d8b26c447ae3e957da40c92cc1dd
MD5 b3f22351f9c3549ee73188dd32009b22
BLAKE2b-256 40637e6728874c289b27431fa74dc33515b42f7fe43dadd46ece728457de2b49

See more details on using hashes here.

Provenance

The following attestation bundles were made for splunkctl-0.13.0.tar.gz:

Publisher: publish.yml on dannyota/splunkctl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file splunkctl-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: splunkctl-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 321.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for splunkctl-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6401a588515a98c39ccf8d9fe7d08a027e48859c306259c993737c0de2f0c03b
MD5 672308c327dd77a6f73899bbdfce75c9
BLAKE2b-256 e3b3c5bfea98c98fd19f0c0d2152e4150558abb0aeeddbc4c24f49db65e0b72f

See more details on using hashes here.

Provenance

The following attestation bundles were made for splunkctl-0.13.0-py3-none-any.whl:

Publisher: publish.yml on dannyota/splunkctl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page