data
Splunk CLI for AI Agents
Use the Splunk CLI from KosmoKrator to call Splunk tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.Splunk CLI Setup
Splunk can be configured headlessly with `kosmokrator integrations:configure splunk`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure splunk --set access_token="$SPLUNK_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor splunk --json
kosmokrator integrations:status --json Credentials
Authentication type: Bearer token bearer_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
access_token | SPLUNK_ACCESS_TOKEN | Secret secret | yes | Access Token |
url | SPLUNK_URL | URL url | no | Splunk Services URL |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call splunk.splunk_search '{"query":"example_query","earliest_time":"example_earliest_time","latest_time":"example_latest_time","exec_mode":"example_exec_mode","options":"example_options"}' --json kosmo integrations:splunk splunk_search '{"query":"example_query","earliest_time":"example_earliest_time","latest_time":"example_latest_time","exec_mode":"example_exec_mode","options":"example_options"}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs splunk --json
kosmo integrations:docs splunk.splunk_search --json
kosmo integrations:schema splunk.splunk_search --json
kosmo integrations:search "Splunk" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
splunk.splunk_search
Run a Splunk search query (SPL). Creates an asynchronous search job and returns the search ID (SID). Use splunk_get_search_results to retrieve results once the job completes.
write - Parameters
- query, earliest_time, latest_time, exec_mode, options
kosmo integrations:call splunk.splunk_search '{"query":"example_query","earliest_time":"example_earliest_time","latest_time":"example_latest_time","exec_mode":"example_exec_mode","options":"example_options"}' --json kosmo integrations:splunk splunk_search '{"query":"example_query","earliest_time":"example_earliest_time","latest_time":"example_latest_time","exec_mode":"example_exec_mode","options":"example_options"}' --json splunk.splunk_export_search
Run a Splunk export search and return the parsed or raw response.
read - Parameters
- query, earliest_time, latest_time, options
kosmo integrations:call splunk.splunk_export_search '{"query":"example_query","earliest_time":"example_earliest_time","latest_time":"example_latest_time","options":"example_options"}' --json kosmo integrations:splunk splunk_export_search '{"query":"example_query","earliest_time":"example_earliest_time","latest_time":"example_latest_time","options":"example_options"}' --json splunk.splunk_list_search_jobs
List Splunk search jobs with pagination and optional server-side filtering.
read - Parameters
- count, offset, search
kosmo integrations:call splunk.splunk_list_search_jobs '{"count":1,"offset":1,"search":"example_search"}' --json kosmo integrations:splunk splunk_list_search_jobs '{"count":1,"offset":1,"search":"example_search"}' --json splunk.splunk_get_search_job
Get status and metadata for a Splunk search job by SID.
read - Parameters
- sid
kosmo integrations:call splunk.splunk_get_search_job '{"sid":"example_sid"}' --json kosmo integrations:splunk splunk_get_search_job '{"sid":"example_sid"}' --json splunk.splunk_delete_search_job
Cancel or delete a Splunk search job by SID.
write - Parameters
- sid
kosmo integrations:call splunk.splunk_delete_search_job '{"sid":"example_sid"}' --json kosmo integrations:splunk splunk_delete_search_job '{"sid":"example_sid"}' --json splunk.splunk_get_search_results
Retrieve results from a completed Splunk search job. Pass the search ID (SID) returned by splunk_search. Supports pagination with offset and count parameters.
read - Parameters
- sid, offset, count
kosmo integrations:call splunk.splunk_get_search_results '{"sid":"example_sid","offset":1,"count":1}' --json kosmo integrations:splunk splunk_get_search_results '{"sid":"example_sid","offset":1,"count":1}' --json splunk.splunk_get_search_events
Retrieve event rows from a completed Splunk search job.
read - Parameters
- sid, offset, count
kosmo integrations:call splunk.splunk_get_search_events '{"sid":"example_sid","offset":1,"count":1}' --json kosmo integrations:splunk splunk_get_search_events '{"sid":"example_sid","offset":1,"count":1}' --json splunk.splunk_get_search_log
Retrieve the search.log text for a Splunk search job.
read - Parameters
- sid
kosmo integrations:call splunk.splunk_get_search_log '{"sid":"example_sid"}' --json kosmo integrations:splunk splunk_get_search_log '{"sid":"example_sid"}' --json splunk.splunk_list_indexes
List all Splunk indexes available to the authenticated user. Returns index names, sizes, event counts, and retention settings.
read - Parameters
- count, offset
kosmo integrations:call splunk.splunk_list_indexes '{"count":1,"offset":1}' --json kosmo integrations:splunk splunk_list_indexes '{"count":1,"offset":1}' --json splunk.splunk_get_index
Get details for a specific Splunk index by name. Returns configuration, size, event count, and retention policy.
read - Parameters
- name
kosmo integrations:call splunk.splunk_get_index '{"name":"example_name"}' --json kosmo integrations:splunk splunk_get_index '{"name":"example_name"}' --json splunk.splunk_create_index
Create a Splunk index with optional index settings.
write - Parameters
- name, options
kosmo integrations:call splunk.splunk_create_index '{"name":"example_name","options":"example_options"}' --json kosmo integrations:splunk splunk_create_index '{"name":"example_name","options":"example_options"}' --json splunk.splunk_update_index
Update Splunk index configuration parameters.
write - Parameters
- name, options
kosmo integrations:call splunk.splunk_update_index '{"name":"example_name","options":"example_options"}' --json kosmo integrations:splunk splunk_update_index '{"name":"example_name","options":"example_options"}' --json splunk.splunk_delete_index
Delete a Splunk index by name.
write - Parameters
- name
kosmo integrations:call splunk.splunk_delete_index '{"name":"example_name"}' --json kosmo integrations:splunk splunk_delete_index '{"name":"example_name"}' --json splunk.splunk_list_saved_searches
List all saved searches configured in Splunk. Returns search names, queries, schedules, and alert settings.
read - Parameters
- count, offset, search
kosmo integrations:call splunk.splunk_list_saved_searches '{"count":1,"offset":1,"search":"example_search"}' --json kosmo integrations:splunk splunk_list_saved_searches '{"count":1,"offset":1,"search":"example_search"}' --json splunk.splunk_get_saved_search
Get a Splunk saved search by name.
read - Parameters
- name
kosmo integrations:call splunk.splunk_get_saved_search '{"name":"example_name"}' --json kosmo integrations:splunk splunk_get_saved_search '{"name":"example_name"}' --json splunk.splunk_create_saved_search
Create a Splunk saved search with optional schedule or alert settings.
write - Parameters
- name, query, options
kosmo integrations:call splunk.splunk_create_saved_search '{"name":"example_name","query":"example_query","options":"example_options"}' --json kosmo integrations:splunk splunk_create_saved_search '{"name":"example_name","query":"example_query","options":"example_options"}' --json splunk.splunk_update_saved_search
Update a Splunk saved search by name.
write - Parameters
- name, options
kosmo integrations:call splunk.splunk_update_saved_search '{"name":"example_name","options":"example_options"}' --json kosmo integrations:splunk splunk_update_saved_search '{"name":"example_name","options":"example_options"}' --json splunk.splunk_delete_saved_search
Delete a Splunk saved search by name.
write - Parameters
- name
kosmo integrations:call splunk.splunk_delete_saved_search '{"name":"example_name"}' --json kosmo integrations:splunk splunk_delete_saved_search '{"name":"example_name"}' --json splunk.splunk_dispatch_saved_search
Dispatch a saved search and return the generated search job.
write - Parameters
- name, options
kosmo integrations:call splunk.splunk_dispatch_saved_search '{"name":"example_name","options":"example_options"}' --json kosmo integrations:splunk splunk_dispatch_saved_search '{"name":"example_name","options":"example_options"}' --json splunk.splunk_list_apps
List installed Splunk apps.
read - Parameters
- count, offset
kosmo integrations:call splunk.splunk_list_apps '{"count":1,"offset":1}' --json kosmo integrations:splunk splunk_list_apps '{"count":1,"offset":1}' --json splunk.splunk_get_app
Get an installed Splunk app by name.
read - Parameters
- name
kosmo integrations:call splunk.splunk_get_app '{"name":"example_name"}' --json kosmo integrations:splunk splunk_get_app '{"name":"example_name"}' --json splunk.splunk_list_users
List Splunk users visible to the authenticated token.
read - Parameters
- count, offset
kosmo integrations:call splunk.splunk_list_users '{"count":1,"offset":1}' --json kosmo integrations:splunk splunk_list_users '{"count":1,"offset":1}' --json splunk.splunk_get_user
Get a Splunk user by username.
read - Parameters
- username
kosmo integrations:call splunk.splunk_get_user '{"username":"example_username"}' --json kosmo integrations:splunk splunk_get_user '{"username":"example_username"}' --json splunk.splunk_get_current_user
Get the current authenticated Splunk user context. Returns username, roles, capabilities, and tenant information.
read - Parameters
- none
kosmo integrations:call splunk.splunk_get_current_user '{}' --json kosmo integrations:splunk splunk_get_current_user '{}' --json splunk.splunk_get_server_info
Get Splunk server version, build, and platform information.
read - Parameters
- none
kosmo integrations:call splunk.splunk_get_server_info '{}' --json kosmo integrations:splunk splunk_get_server_info '{}' --json splunk.splunk_api_get
Call a safe relative Splunk services path with GET.
read - Parameters
- path, params
kosmo integrations:call splunk.splunk_api_get '{"path":"example_path","params":"example_params"}' --json kosmo integrations:splunk splunk_api_get '{"path":"example_path","params":"example_params"}' --json splunk.splunk_api_post
Call a safe relative Splunk services path with POST form parameters.
write - Parameters
- path, payload, params
kosmo integrations:call splunk.splunk_api_post '{"path":"example_path","payload":"example_payload","params":"example_params"}' --json kosmo integrations:splunk splunk_api_post '{"path":"example_path","payload":"example_payload","params":"example_params"}' --json splunk.splunk_api_delete
Call a safe relative Splunk services path with DELETE.
write - Parameters
- path, params
kosmo integrations:call splunk.splunk_api_delete '{"path":"example_path","params":"example_params"}' --json kosmo integrations:splunk splunk_api_delete '{"path":"example_path","params":"example_params"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
splunk.splunk_search 5 parameters
kosmo integrations:schema splunk.splunk_search --json | Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | The SPL search query (e.g., "search index=main error | head 100"). |
earliest_time | string | no | Earliest time for the search time range. Supports relative (e.g., "-24h", "-7d") or absolute (e.g., "2025-01-01T00:00:00") format. |
latest_time | string | no | Latest time for the search time range. Supports relative (e.g., "now") or absolute (e.g., "2025-01-31T23:59:59") format. |
exec_mode | string | no | Splunk execution mode. Defaults to normal. |
options | object | no | Additional search/jobs form parameters. |
splunk.splunk_export_search 4 parameters
kosmo integrations:schema splunk.splunk_export_search --json | Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | SPL search query. |
earliest_time | string | no | Optional earliest time. |
latest_time | string | no | Optional latest time. |
options | object | no | Additional export parameters. |
splunk.splunk_list_search_jobs 3 parameters
kosmo integrations:schema splunk.splunk_list_search_jobs --json | Parameter | Type | Required | Description |
|---|---|---|---|
count | integer | no | Maximum number of jobs. |
offset | integer | no | Pagination offset. |
search | string | no | Optional server-side search filter. |
splunk.splunk_get_search_job 1 parameters
kosmo integrations:schema splunk.splunk_get_search_job --json | Parameter | Type | Required | Description |
|---|---|---|---|
sid | string | yes | Search job ID. |
splunk.splunk_delete_search_job 1 parameters
kosmo integrations:schema splunk.splunk_delete_search_job --json | Parameter | Type | Required | Description |
|---|---|---|---|
sid | string | yes | Search job ID. |
splunk.splunk_get_search_results 3 parameters
kosmo integrations:schema splunk.splunk_get_search_results --json | Parameter | Type | Required | Description |
|---|---|---|---|
sid | string | yes | The search job ID (SID) returned by a previous search. |
offset | integer | no | The starting offset for pagination (0-based, default: 0). |
count | integer | no | The number of results to return per page (default: 100). |
splunk.splunk_get_search_events 3 parameters
kosmo integrations:schema splunk.splunk_get_search_events --json | Parameter | Type | Required | Description |
|---|---|---|---|
sid | string | yes | Search job ID. |
offset | integer | no | Pagination offset. |
count | integer | no | Number of events. |
splunk.splunk_get_search_log 1 parameters
kosmo integrations:schema splunk.splunk_get_search_log --json | Parameter | Type | Required | Description |
|---|---|---|---|
sid | string | yes | Search job ID. |
splunk.splunk_list_indexes 2 parameters
kosmo integrations:schema splunk.splunk_list_indexes --json | Parameter | Type | Required | Description |
|---|---|---|---|
count | integer | no | Maximum number of indexes to return. |
offset | integer | no | Pagination offset. |
splunk.splunk_get_index 1 parameters
kosmo integrations:schema splunk.splunk_get_index --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | The name of the Splunk index to retrieve (e.g., "main", "_internal"). |
splunk.splunk_create_index 2 parameters
kosmo integrations:schema splunk.splunk_create_index --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Index name. |
options | object | no | Additional index creation parameters. |
splunk.splunk_update_index 2 parameters
kosmo integrations:schema splunk.splunk_update_index --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Index name. |
options | object | yes | Index update parameters. |
splunk.splunk_delete_index 1 parameters
kosmo integrations:schema splunk.splunk_delete_index --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Index name. |
splunk.splunk_list_saved_searches 3 parameters
kosmo integrations:schema splunk.splunk_list_saved_searches --json | Parameter | Type | Required | Description |
|---|---|---|---|
count | integer | no | Maximum number of saved searches to return. |
offset | integer | no | Pagination offset. |
search | string | no | Optional server-side search filter. |
splunk.splunk_get_saved_search 1 parameters
kosmo integrations:schema splunk.splunk_get_saved_search --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Saved search name. |
splunk.splunk_create_saved_search 3 parameters
kosmo integrations:schema splunk.splunk_create_saved_search --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Saved search name. |
query | string | yes | SPL query. |
options | object | no | Additional saved-search parameters. |
splunk.splunk_update_saved_search 2 parameters
kosmo integrations:schema splunk.splunk_update_saved_search --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Saved search name. |
options | object | yes | Saved-search update parameters. |
splunk.splunk_delete_saved_search 1 parameters
kosmo integrations:schema splunk.splunk_delete_saved_search --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Saved search name. |
splunk.splunk_dispatch_saved_search 2 parameters
kosmo integrations:schema splunk.splunk_dispatch_saved_search --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Saved search name. |
options | object | no | Dispatch parameters. |
splunk.splunk_list_apps 2 parameters
kosmo integrations:schema splunk.splunk_list_apps --json | Parameter | Type | Required | Description |
|---|---|---|---|
count | integer | no | Maximum number of apps. |
offset | integer | no | Pagination offset. |
splunk.splunk_get_app 1 parameters
kosmo integrations:schema splunk.splunk_get_app --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | App name. |
splunk.splunk_list_users 2 parameters
kosmo integrations:schema splunk.splunk_list_users --json | Parameter | Type | Required | Description |
|---|---|---|---|
count | integer | no | Maximum number of users. |
offset | integer | no | Pagination offset. |
splunk.splunk_get_user 1 parameters
kosmo integrations:schema splunk.splunk_get_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
username | string | yes | Splunk username. |
splunk.splunk_get_current_user 0 parameters
kosmo integrations:schema splunk.splunk_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
splunk.splunk_get_server_info 0 parameters
kosmo integrations:schema splunk.splunk_get_server_info --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
splunk.splunk_api_get 2 parameters
kosmo integrations:schema splunk.splunk_api_get --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative path under /services. |
params | object | no | Query parameters. |
splunk.splunk_api_post 3 parameters
kosmo integrations:schema splunk.splunk_api_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative path under /services. |
payload | object | no | Form body parameters. |
params | object | no | Query parameters. |
splunk.splunk_api_delete 2 parameters
kosmo integrations:schema splunk.splunk_api_delete --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative path under /services. |
params | object | no | Query parameters. |
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.