grandcamel avatar

splunk-assistant-skills

Complete Splunk automation suite with 14 specialized skills - search execution, job lifecycle, data export, metadata discovery, lookups, saved searches, alerts, and more

version
2.0.0
GitHub stars
17

Install

/plugin install splunk-assistant-skills@splunk-assistant-skills

Run it inside Claude Code after adding the marketplace with /plugin marketplace add grandcamel/Splunk-Assistant-Skills.

Contents

Discovered from source

Skills 14

splunk-alert

Alert triggering, monitoring, and notification management for Splunk.

Purpose

Create and manage alerts, monitor triggered alerts, and configure alert actions.

Risk Levels

OperationRiskNotes
List alerts-Read-only
Get alert details-Read-only
List triggered alerts-Read-only
Create alert⚠️May trigger notifications
Update alert⚠️Previous config lost
Acknowledge alert⚠️Can be re-triggered
Delete alert⚠️⚠️May be recoverable from backup

Triggers

  • "alert", "trigger", "notification"
  • "monitor", "alerting"

CLI Commands

CommandDescription
alert createCreate a new alert
alert getGet alert details
alert listList all alerts (scheduled searches with alert actions)
alert triggeredList triggered alerts
alert acknowledgeAcknowledge a triggered alert

Examples

# Create an alert
splunk-as alert create --name "High Error Rate" \
  --search "index=main sourcetype=app_logs error | stats count" \
  --condition "number of events" \
  --comparator "greater than" \
  --threshold 100 \
  --cron "*/5 * * * *" \
  --actions email \
  --email-to ops@example.com

# List all configured alerts
splunk-as alert list --app search --count 100

# Get specific alert details
splunk-as alert get "High Error Rate"

# List triggered alert instances with filters
splunk-as alert triggered --app search --count 20

# Acknowledge/delete a triggered alert
splunk-as alert acknowledge alert_12345

Alert Configuration

Severity Levels

  • 1 = debug
  • 2 = info
  • 3 = warn (default)
  • 4 = error
  • 5 = severe
  • 6 = fatal

Alert Types

  • always - Trigger on every scheduled execution
  • number of events - Trigger when result count meets condition
  • number of hosts - Trigger when host count meets condition
  • number of sources - Trigger when source count meets condition
  • custom - Custom alert condition

Alert Comparators

  • greater than
  • less than
  • equal to
  • not equal to
  • drops by
  • rises by

Alert Actions

  • email - Send email notification
  • webhook - HTTP POST to webhook URL
  • script - Execute custom script
  • Custom actions configured in Splunk

API Endpoints

  • GET /services/alerts/fired_alerts - List triggered alerts
  • GET /services/alerts/fired_alerts/{name} - Get specific triggered alert
  • DELETE /services/alerts/fired_alerts/{name} - Acknowledge/delete triggered alert
  • POST /servicesNS/nobody/{app}/saved/searches - Create alert (via saved search)
  • GET /servicesNS/nobody/{app}/saved/searches - List alert configurations

splunk-app

Splunk application management.

Purpose

Install, uninstall, enable, disable, and manage Splunk applications.

Risk Levels

OperationRiskNotes
List apps-Read-only
Get app details-Read-only
Enable app⚠️Easily reversible
Disable app⚠️Easily reversible
Install app⚠️⚠️May affect system behavior
Uninstall app⚠️⚠️⚠️IRREVERSIBLE - app files deleted

Triggers

  • "app", "application", "install"
  • "package", "addon"

CLI Commands

CommandDescription
app listList installed apps
app get <name>Get app details
app install <file>Install app from package file (.tar.gz, .tgz, .spl)
app uninstall <name>Remove app
app enable <name>Enable disabled app
app disable <name>Disable app

Options

OptionCommandsDescription
-o, --outputlist, getOutput format (text, json)
-n, --nameinstallApp name (overrides name from package)
--update/--no-updateinstallUpdate if app exists
-f, --forceuninstallSkip confirmation

Examples

# List installed apps
splunk-as app list
splunk-as app list -o json

# Get app details
splunk-as app get search
splunk-as app get search --output json

# Install app (supports .tar.gz, .tgz, .spl formats)
splunk-as app install my_app.tgz
splunk-as app install my_app.spl --update
splunk-as app install package.tar.gz --name custom_app_name

# Uninstall app
splunk-as app uninstall my_app
splunk-as app uninstall my_app --force

# Enable app
splunk-as app enable my_app

# Disable app
splunk-as app disable my_app

API Endpoints

  • GET/POST /services/apps/local - List/Install
  • GET/POST/DELETE /services/apps/local/{name} - CRUD
  • POST /services/apps/local/{name}/package - Export

splunk-assistant

Central hub and router for Splunk Assistant Skills. Routes requests to 17 CLI command groups using 3-level progressive disclosure.

Purpose

Routes natural language requests to specialized Splunk skills based on intent. Provides connection verification, authentication validation, and execution strategy recommendations.

Risk Levels

OperationRiskNotes
Get server info-Read-only
Verify connection-Read-only
Route to skill-Navigation only

Triggers

  • Any Splunk-related request
  • "splunk", "search", "query", "SPL"
  • Connection/authentication issues
  • General Splunk questions

Progressive Disclosure

Level 1: Essential Connection & Identification

  • Verify Search Head connection on management port 8089 via HTTPS
  • Validate JWT Bearer token or Basic Auth credentials
  • Detect deployment type (Cloud vs on-prem)
  • Route to appropriate specialized skill

Level 2: Execution Mode Strategy

ModeUse CaseCharacteristics
OneshotAd-hoc queriesResults inline, no SID, minimal disk I/O
NormalLong searchesReturns SID, poll for results, progress tracking
BlockingSimple queriesWaits for completion, synchronous
ExportLarge extractsStreaming, checkpoint support, ETL

Level 3: Advanced Optimization & Resource Governance

  • Time Modifiers: Always enforce earliest_time and latest_time
  • Field Reduction: Insert fields command to limit data transfer
  • Resource Cleanup: Issue /control/cancel after results consumed
  • Error Handling: Use strict=true for clear errors vs incomplete data

CLI Command Groups

CLI CommandSkillDescription
searchsplunk-searchExecute SPL query
jobsplunk-jobJob lifecycle management
exportsplunk-exportLarge data export
metadatasplunk-metadataIndex/source discovery
lookupsplunk-lookupLookup management
tagsplunk-tagTag operations
savedsearchsplunk-savedsearchSaved searches/reports
alertsplunk-alertAlert management
adminsplunk-rest-adminREST/Server administration
securitysplunk-securityToken/RBAC/ACL
metricssplunk-metricsMetrics (mstats)
appsplunk-appApp management
kvstoresplunk-kvstoreKV Store
dashboard-Dashboard management
input-Data input management
user-User management
config-Configuration management
completion-Shell completion (utility)

Connection Verification

# Get server information (verify connection)
splunk-as admin info

# Get server status
splunk-as admin status

# Get server health status
splunk-as admin health

Examples

Verify Connection

splunk-as admin info
# Output:
# ✓ Connected to splunk.example.com:8089
# ✓ Authentication: Bearer token valid
# ✓ Deployment: Splunk Enterprise 9.1.0
# ✓ User: admin (capabilities: search, admin_all_objects)

Get Server Info

splunk-as admin info --output json
# Output: Server version, build, OS, cluster status, etc.

Common CLI Commands

# Search commands
splunk-as search oneshot "index=main | head 10"
splunk-as search normal "index=main | stats count" --wait

# Job management
splunk-as job list
splunk-as job status 1703779200.12345

# Metadata discovery
splunk-as metadata indexes
splunk-as metadata sourcetypes --index main

# Security
splunk-as security whoami

Best Practices

  1. Always include time bounds - Prevent full index scans
  2. Use field extraction - Limit data transfer
  3. Choose appropriate mode - Oneshot for ad-hoc, Export for ETL
  4. Clean up resources - Cancel jobs when done
  5. Handle errors gracefully - Use the error hierarchy

Related Skills

splunk-export

High-volume streaming data extraction for Splunk.

Purpose

Export large result sets (>50,000 rows) efficiently using streaming.

Risk Levels

OperationRiskNotes
Export results-Read-only
Export from job-Read-only
Estimate size-Read-only

Triggers

  • "export", "download", "extract"
  • "stream", "large results", "ETL"
  • "backup", "archive"

CLI Commands

CommandDescription
export estimateEstimate export size
export jobExport from existing job
export resultsExport results to file
export streamStream large exports efficiently

Options

OptionCommandsDescription
-o, --output-filejob, results, streamOutput file path (required)
-f, --formatjob, results, streamExport format (csv, json, json_rows, xml)
-e, --earliestestimate, results, streamEarliest time
-l, --latestestimate, results, streamLatest time
-c, --countjob, streamMaximum results to export
--fieldsresults, streamComma-separated fields to export
--progressresultsShow progress

Examples

Export Results

# Export to CSV (using short flags)
splunk-as export results "index=main | head 1000" -o results.csv

# Export to JSON with specific fields
splunk-as export results "index=main" -o data.json -f json --fields host,status

# Export with progress indicator
splunk-as export results "index=main | stats count by host" -o report.csv --progress

Export from Existing Job

# Export results from a completed search job
splunk-as export job 1703779200.12345 -o job_results.csv

# Export with count limit
splunk-as export job 1703779200.12345 -o results.csv -c 10000

# Export as JSON array (json_rows format)
splunk-as export job 1703779200.12345 -o data.json -f json_rows

Stream Export

# Stream large export efficiently
splunk-as export stream "index=main | head 1000000" -o large_results.csv

# Stream with count limit
splunk-as export stream "index=main" -o results.csv -c 50000

# Stream with specific fields
splunk-as export stream "index=main" -o data.json -f json_rows --fields host,status

Estimate Size

# Preview count before export
splunk-as export estimate "index=main | stats count by host" -e -7d
# Output: Estimated 1,234,567 results

API Endpoints

EndpointDescription
GET /services/search/v2/jobs/{sid}/resultsStream results
GET /services/search/v2/jobs/{sid}/eventsStream raw events

Parameters

ParameterDescription
count=0Return all results (no limit)
output_modecsv, json, xml, raw
field_listComma-separated fields

Best Practices

  1. Use streaming for >50K results
  2. Estimate size first before large exports
  3. Limit fields to reduce data transfer
  4. Monitor progress for long-running exports
  5. Compress output for storage efficiency

Related Skills

splunk-job

Search job lifecycle orchestration for Splunk.

Purpose

Manage the complete lifecycle of Splunk search jobs including creation, monitoring, control actions (pause/cancel/finalize), and cleanup.

Risk Levels

OperationRiskNotes
Get job status-Read-only
List jobs-Read-only
Create job-Easily reversible via cancel
Pause/unpause job⚠️Can be undone
Finalize job⚠️Returns partial results
Cancel job⚠️Stops execution
Delete job⚠️⚠️Removes job and results

Triggers

  • "job", "search job", "SID"
  • "status", "progress", "state"
  • "cancel", "pause", "unpause", "finalize"
  • "list jobs", "delete job"

Job States (dispatchState)

QUEUED → PARSING → RUNNING → FINALIZING → DONE
                                        → FAILED
                 → PAUSED (on pause action)
StateDescription
QUEUEDJob waiting in queue
PARSINGSPL being parsed
RUNNINGSearch executing
FINALIZINGResults being finalized
DONECompleted successfully
FAILEDError occurred
PAUSEDPaused by user

CLI Commands

CommandDescription
job createCreate search job, return SID
job statusGet dispatchState, progress, stats
job pollWait for job completion with timeout
job cancelIssue /control/cancel action
job pauseIssue /control/pause action
job unpauseIssue /control/unpause action
job finalizeIssue /control/finalize action
job ttlSet job time-to-live
job touchTouch a job to extend its TTL
job listList all search jobs for user
job deleteRemove job from dispatch directory

Examples

Create and Monitor Job

# Create job
splunk-as job create "index=main | stats count by sourcetype" --earliest -1h
# Output: Job created: 1703779200.12345

# Check status
splunk-as job status 1703779200.12345
# Output: State: RUNNING, Progress: 45%, Events: 12345

# Wait for completion
splunk-as job poll 1703779200.12345 --timeout 300
# Output: Job completed: DONE, Results: 42

Job Control

# Pause running job
splunk-as job pause 1703779200.12345

# Resume paused job
splunk-as job unpause 1703779200.12345

# Cancel job
splunk-as job cancel 1703779200.12345

# Finalize (stop and return current results)
splunk-as job finalize 1703779200.12345

Job Management

# List all jobs
splunk-as job list
# Output: Table of active jobs with status

# Extend TTL (positional arg: SID TTL_VALUE)
splunk-as job ttl 1703779200.12345 3600

# Delete job
splunk-as job delete 1703779200.12345

API Endpoints

EndpointMethodDescription
/services/search/v2/jobsPOSTCreate job
/services/search/v2/jobs/{sid}GETGet job status
/services/search/v2/jobs/{sid}/controlPOSTControl actions
/services/search/jobsGETList jobs
/services/search/jobs/{sid}DELETEDelete job

Control Actions

# Available actions for /control endpoint
actions = ['cancel', 'pause', 'unpause', 'finalize', 'touch', 'setttl', 'enablepreview', 'disablepreview']

# POST /services/search/v2/jobs/{sid}/control
# data={'action': 'cancel'}

Job Properties

PropertyDescription
sidSearch job ID
dispatchStateCurrent state
doneProgressCompletion 0.0-1.0
eventCountEvents scanned
resultCountResults produced
scanCountBuckets scanned
runDurationExecution time
ttlTime to live
isFailedFailure flag
isPausedPause flag

Best Practices

  1. Always set time bounds in the search query
  2. Use appropriate timeout for poll_job.py
  3. Cancel jobs when results are no longer needed
  4. Monitor progress for long-running searches
  5. Extend TTL for jobs you need to keep

Related Skills

splunk-kvstore

Interaction with App Key Value Store for persistent metadata.

Purpose

Create and manage KV store collections and records for persistent data storage.

Risk Levels

OperationRiskNotes
List collections-Read-only
Get record-Read-only
Query collection-Read-only
Insert record⚠️Easily reversible
Create collection⚠️Easily reversible
Update record⚠️Previous value lost
Delete record⚠️⚠️Data loss, may be in backups
Delete collection⚠️⚠️⚠️IRREVERSIBLE - all data lost

Triggers

  • "kvstore", "collection", "key-value"
  • "persist", "store"

CLI Commands

CommandDescription
kvstore listList collections in app
kvstore create <name>Create KV store collection
kvstore delete <name>Delete collection (IRREVERSIBLE)
kvstore truncate <collection>Delete all records in collection
kvstore insert <collection>Insert record into collection
kvstore batch-insert <collection>Insert multiple records at once
kvstore get <collection> <key>Get record by _key
kvstore update <collection> <key>Update existing record
kvstore delete-record <collection> <key>Delete individual record by _key
kvstore query <collection>Query with filters

Examples

# Show help
splunk-as kvstore --help

# List collections
splunk-as kvstore list --app search

# Create collection
splunk-as kvstore create my_collection --app search

# Insert record
splunk-as kvstore insert my_collection '{"name": "test", "value": 123}' --app search

# Get record by _key
splunk-as kvstore get my_collection abc123 --app search

# Query collection with filters
splunk-as kvstore query my_collection --query '{"name": "test"}' --app search

# Update record by _key
splunk-as kvstore update my_collection abc123 '{"name": "updated"}' --app search

# Delete individual record by _key (use delete-record, not delete)
splunk-as kvstore delete-record my_collection abc123 --app search

# Truncate collection (delete all records, keep collection)
splunk-as kvstore truncate my_collection --app search

# Batch insert multiple records from JSON file
splunk-as kvstore batch-insert my_collection records.json --app search

# Delete collection (IRREVERSIBLE - removes collection and all records)
splunk-as kvstore delete my_collection --app search --force

Command Terminology

CommandTargetDescription
delete-recordSingle recordDeletes one record by its _key
deleteCollectionDeletes entire collection and all records (IRREVERSIBLE)

API Endpoints

  • GET/POST/DELETE /services/storage/collections/config - Collections
  • GET/POST /services/storage/collections/data/{collection} - Records
  • GET/PUT/DELETE /services/storage/collections/data/{collection}/{key} - Record

SPL Patterns

| inputlookup collection_name
| outputlookup collection_name append=true

splunk-lookup

CSV and lookup file management for Splunk.

Purpose

Upload, download, and manage CSV lookup files and lookup definitions.

Risk Levels

OperationRiskNotes
List lookups-Read-only
Get lookup info-Read-only
Download lookup-Read-only
Upload lookup⚠️Creates new or overwrites
Delete lookup⚠️⚠️May be recoverable from backup

Triggers

  • "lookup", "CSV", "upload"
  • "lookup table", "enrichment"

CLI Commands

CommandDescription
lookup listList lookup files
lookup getGet contents of a lookup file
lookup uploadUpload CSV lookup file
lookup downloadDownload lookup file
lookup deleteRemove lookup file
lookup transformsList lookup transforms/definitions

Options

OptionCommandsDescription
-a, --appallApp context (defaults to "search" for most commands)
-o, --outputlist, get, transformsOutput format (text, json; get also supports csv)
-c, --countgetMaximum rows to show
-n, --nameuploadLookup name (defaults to filename)
-f, --forcedeleteSkip confirmation
--output-filedownloadOutput file path

App Context

The -a/--app option specifies the Splunk app context:

  • Optional for listing: Filter results to a specific app
  • Required for upload: Specifies where to store the lookup
  • Recommended for get/download/delete: Ensures you target the correct lookup file

Default behavior varies by command. When multiple apps have lookups with the same name, always specify --app.

Examples

# List lookups (with output format)
splunk-as lookup list -a search
splunk-as lookup list -a search -o json

# Get lookup contents (with count limit)
splunk-as lookup get users.csv -a search
splunk-as lookup get users.csv -a search -c 100 -o csv

# Upload lookup (with custom name)
splunk-as lookup upload users.csv -a search
splunk-as lookup upload /path/to/data.csv -a search -n custom_lookup

# Download lookup
splunk-as lookup download users.csv --output-file ./users.csv

# Delete lookup (with force flag)
splunk-as lookup delete old_users.csv -a search
splunk-as lookup delete old_users.csv -a search -f

# List lookup transforms/definitions
splunk-as lookup transforms -a search
splunk-as lookup transforms -a search -o json

API Endpoints

  • POST /services/data/lookup-table-files - Upload
  • GET /services/data/lookup-table-files - List
  • GET/DELETE /services/data/lookup-table-files/{name} - Get/Delete

splunk-metadata

Query index, source, and sourcetype configurations for Splunk.

Purpose

Discover and explore metadata about indexes, sources, sourcetypes, and fields.

Risk Levels

OperationRiskNotes
List indexes-Read-only
Get index info-Read-only
List sources-Read-only
List sourcetypes-Read-only
Get field summary-Read-only
Metadata search-Read-only

Triggers

  • "metadata", "index", "source", "sourcetype"
  • "fields", "discovery", "catalog"

CLI Commands

CommandDescription
metadata indexesList available indexes
metadata index-infoIndex size, event count, time range
metadata sourcesUnique sources per index
metadata sourcetypesSourcetypes in use
metadata searchExecute | metadata search (supports hosts, sources, sourcetypes)
metadata fieldsField summary for index/sourcetype

Options

OptionCommandsDescription
-f, --filterindexesFilter indexes by name pattern
-o, --outputindexes, sources, sourcetypes, search, fieldsOutput format (text, json)
-i, --indexsources, sourcetypes, searchFilter by index
-e, --earliestsearch, fieldsEarliest time
-s, --sourcetypefieldsFilter by sourcetype

Examples

# List all indexes (with filter and output options)
splunk-as metadata indexes
splunk-as metadata indexes -f "main*" -o json

# Get index details
splunk-as metadata index-info main

# List sourcetypes (with output format)
splunk-as metadata sourcetypes -i main
splunk-as metadata sourcetypes -i main -o json

# List sources
splunk-as metadata sources -i main
splunk-as metadata sources -i main -o json

# Field summary (with earliest time)
splunk-as metadata fields main -s access_combined
splunk-as metadata fields main -s access_combined -e -24h -o json

# Metadata search (with time range)
splunk-as metadata search sourcetypes -i main
splunk-as metadata search hosts -i main -e -7d
splunk-as metadata search sources -i main -o json

SPL Patterns

# Metadata command
| metadata type=sourcetypes index=main

# Metasearch
| metasearch index=* sourcetype=access_combined

# Field summary
| fieldsummary maxvals=100

Related Skills

splunk-metrics

Real-time metrics and data point analysis for Splunk.

Purpose

Query and analyze metrics data using mstats and mcatalog commands.

Risk Levels

OperationRiskNotes
List metrics-Read-only
List metric indexes-Read-only
Query with mstats-Read-only
Discover with mcatalog-Read-only

Triggers

  • "metrics", "mstats", "mcatalog"
  • "time series", "data points"

CLI Commands

CommandDescription
metrics mstatsExecute mstats command
metrics mcatalogQuery metrics catalog
metrics mpreviewPreview metrics data
metrics indexesList metric indexes
metrics listList metric names

Options

OptionCommandsDescription
-i, --indexmstats, mcatalog, mpreview, listMetrics index
-o, --outputmcatalog, mpreviewOutput format (text, json)
-m, --metricmcatalogFilter by metric name pattern
-f, --filtermpreviewFilter expression (e.g., host=server1)
-c, --countmpreviewNumber of data points
--aggmstatsAggregation function
--split-bymstatsSplit by field
--spanmstatsTime span

Examples

# List metrics
splunk-as metrics list -i metrics

# List metric indexes
splunk-as metrics indexes

# Query with mstats
splunk-as metrics mstats cpu.percent --agg avg --split-by host --span 1h

# Discover metrics with mcatalog (use -m/--metric for filtering)
splunk-as metrics mcatalog -i metrics -m "cpu.*"
splunk-as metrics mcatalog -i metrics -o json

# Preview metrics data (requires metric_name positional arg)
splunk-as metrics mpreview cpu.percent -i metrics
splunk-as metrics mpreview cpu.percent -i metrics -f "host=server1" -c 50

SPL Patterns

| mstats avg(cpu.percent) WHERE index=metrics BY host span=1h
| mcatalog values(metric_name) WHERE index=metrics
| mpreview index=metrics

splunk-rest-admin

Programmatic access to internal configurations via REST command.

Purpose

Query and manage Splunk server configurations, users, roles, and system info.

Risk Levels

OperationRiskNotes
REST GET request-Read-only
Get server info-Read-only
List users/roles-Read-only
REST POST request⚠️⚠️May modify server config

Triggers

  • "rest", "admin", "config"
  • "server", "settings", "info"

CLI Commands

CommandDescription
admin infoGet server information
admin statusGet server status
admin healthGet server health
admin list-usersList all users
admin list-rolesList all roles
admin rest-getMake GET request to REST endpoint
admin rest-postMake POST request to REST endpoint

REST Options

OptionDescription
-d, --dataJSON data payload for POST requests
-a, --appApp context for REST requests
--ownerOwner context for REST requests
-o, --outputOutput format (text, json)

Examples

# Get server info
splunk-as admin info
splunk-as admin info --output json

# Get server status
splunk-as admin status
splunk-as admin status --output json

# Get server health
splunk-as admin health
splunk-as admin health --output json

# List users
splunk-as admin list-users

# List roles
splunk-as admin list-roles

# REST GET request - users
splunk-as admin rest-get /services/authentication/users

# REST GET request - server info
splunk-as admin rest-get /services/server/info

# REST GET request - apps with app/owner context
splunk-as admin rest-get /services/apps/local --app search --owner admin

# REST POST request with app/owner context
splunk-as admin rest-post /services/saved/searches -d '{"name": "test"}' --app search --owner admin

SPL Patterns

| rest /services/server/info
| rest /services/authentication/users
| rest /services/admin/conf-times

splunk-savedsearch

CRUD for reports and scheduled searches in Splunk.

Purpose

Create, read, update, delete saved searches, reports, and scheduled searches.

Risk Levels

OperationRiskNotes
List saved searches-Read-only
Get saved search-Read-only
Run saved search-Read-only execution
Create saved search⚠️Can be deleted
Update saved search⚠️Previous version lost
Enable/disable schedule⚠️Easily reversible
Delete saved search⚠️⚠️May be recoverable from backup

Triggers

  • "saved search", "report", "schedule"
  • "scheduled search", "alert"

CLI Commands

Commands provided by the splunk-as package (pip install splunk-as):

CommandDescription
savedsearch listList saved searches in app
savedsearch getGet saved search details
savedsearch createCreate saved search/report
savedsearch updateModify saved search
savedsearch runExecute saved search on-demand
savedsearch historyGet saved search execution history
savedsearch enableEnable scheduled execution
savedsearch disableDisable scheduling
savedsearch deleteDelete saved search

Examples

# List saved searches
splunk-as savedsearch list --app search

# Get saved search details
splunk-as savedsearch get "My Report"

# Create saved search (use --name and --search options)
splunk-as savedsearch create --name "My Report" --search "index=main | stats count" --app search

# Update saved search
splunk-as savedsearch update "My Report" --search "index=main | stats count by host"

# Run saved search (--wait/--no-wait controls blocking)
splunk-as savedsearch run "My Report" --wait
splunk-as savedsearch run "My Report" --no-wait

# Get execution history (default shows 10 entries)
splunk-as savedsearch history "My Report"
splunk-as savedsearch history "My Report" -c 20

# Enable scheduling
splunk-as savedsearch enable "My Report"

# Disable scheduling
splunk-as savedsearch disable "My Report"

# Delete saved search
splunk-as savedsearch delete "My Report"

API Endpoints

  • GET/POST /services/saved/searches - CRUD
  • POST /services/saved/searches/{name}/dispatch - Run
  • GET /services/saved/searches/{name}/history - History

splunk-search

SPL query execution in multiple modes for Splunk.

Purpose

Execute SPL (Search Processing Language) queries using various execution modes: oneshot (inline results), normal (async with polling), and blocking (sync wait).

Risk Levels

OperationRiskNotes
Execute search (read)-Read-only query
Get results-Read-only
Validate SPL-Read-only
Execute search (write)⚠️⚠️SPL with `

Triggers

  • "search", "SPL", "query", "find"
  • "oneshot", "blocking", "async"
  • "execute", "run search"

Search Modes

ModeUse CaseReturns SIDWait for Results
OneshotAd-hoc queries < 50K rowsNoInline
NormalLong-running searchesYesAsync (poll)
BlockingSimple queriesYesSync (waits)

CLI Commands

CommandDescription
search oneshotExecute oneshot search (results inline)
search normalExecute normal search (returns SID)
search blockingExecute blocking search (waits)
search resultsGet results from completed job
search previewGet partial results during search
search validateValidate SPL syntax

Examples

Oneshot Search (Recommended for Ad-hoc)

# Simple search
splunk-as search oneshot "index=main | stats count by sourcetype"

# With time range
splunk-as search oneshot "index=main | head 100" --earliest -1h --latest now

# Output as JSON
splunk-as search oneshot "index=main | top host" --output json

# With count limit and specific fields
splunk-as search oneshot "index=main" --count 100 --fields host,status

# Output to file
splunk-as search oneshot "index=main | head 1000" --output-file results.csv

# Using short flags (-e earliest, -l latest, -c count, -f fields, -o output format)
splunk-as search oneshot "index=main" -e -1h -l now -c 100 -f host,status -o json

# Save to file with --output-file
splunk-as search oneshot "index=main" -e -1h -c 100 --output-file results.csv

Normal Search (Async)

# Create job and poll
splunk-as search normal "index=main | stats count" --wait

# Create job only (returns SID)
splunk-as search normal "index=main | stats count"
# Then use: splunk-as search results <SID>

Blocking Search (Sync)

# Wait for completion and return results
splunk-as search blocking "index=main | head 10" --timeout 60

Get Results

# From completed job
splunk-as search results 1703779200.12345

# With pagination (using short flags)
splunk-as search results 1703779200.12345 -c 100 --offset 0

# Specific fields only
splunk-as search results 1703779200.12345 -f host,status,uri

# Output format and save to file
splunk-as search results 1703779200.12345 -o json
splunk-as search results 1703779200.12345 --output-file results.csv

Validate SPL

# Validate SPL syntax
splunk-as search validate "index=main | stats count"

# Validate with suggestions for fixes (-s/--suggestions)
splunk-as search validate "index=main | stats count" -s

API Endpoints

EndpointModeDescription
POST /services/search/jobs/oneshotOneshotInline results
POST /services/search/v2/jobsNormalCreate async job
POST /services/search/v2/jobs + exec_mode=blockingBlockingSync wait
GET /services/search/v2/jobs/{sid}/results-Get results
GET /services/search/v2/jobs/{sid}/results_preview-Get preview

Request Parameters

ParameterDescriptionDefault
searchSPL queryRequired
earliest_timeStart time-24h
latest_timeEnd timenow
exec_modenormal/blockingnormal
max_countMax results50000
output_modejson/csv/xmljson

Best Practices

  1. Always include time bounds - Prevents full index scans
  2. Use oneshot for ad-hoc - Minimal resource usage
  3. Add fields command - Reduce data transfer
  4. Validate SPL first - Catch syntax errors early
  5. Handle pagination - Use count/offset for large results

SPL Quick Reference

# Basic search with time
index=main earliest=-1h | head 100

# Statistics
index=main | stats count by status | sort -count

# Time chart
index=main | timechart span=1h count by sourcetype

# Field extraction
index=main | fields host, status, uri | table host status uri

# Filtering
index=main status>=400 | stats count by status

# Subsearch
index=main [search index=alerts | fields src_ip | head 100]

Related Skills

splunk-security

Token management, RBAC, and ACL verification for Splunk.

Purpose

Manage JWT tokens, check permissions, and configure ACLs on knowledge objects.

Risk Levels

OperationRiskNotes
Get current user-Read-only
List users/roles-Read-only
List tokens-Read-only
Get capabilities-Read-only
Check permission-Read-only
Get ACL-Read-only
Create token⚠️Security credential created
Delete token⚠️⚠️Breaks dependent integrations
Modify ACL⚠️⚠️Changes access permissions

Triggers

  • "token", "permission", "ACL"
  • "security", "RBAC", "role"
  • "access", "capabilities"

CLI Commands

CommandDescription
security whoamiGet current user info
security list-usersList all users
security list-rolesList all roles
security list-tokensList auth tokens
security create-tokenCreate auth token
security delete-tokenDelete auth token
security capabilitiesGet user capabilities
security checkCheck if user has capability
security aclGet ACL for resource

Options

OptionCommandsDescription
-o, --outputwhoami, list-users, list-roles, list-tokens, capabilities, aclOutput format (text, json)
-n, --namecreate-tokenToken name (required)
--audiencecreate-tokenToken audience (optional)
--expirescreate-tokenExpiration time in seconds (optional)

Examples

# Get current user info (with output format)
splunk-as security whoami
splunk-as security whoami -o json

# List users
splunk-as security list-users
splunk-as security list-users -o json

# List roles
splunk-as security list-roles
splunk-as security list-roles -o json

# List tokens
splunk-as security list-tokens
splunk-as security list-tokens -o json

# Create token (--name required, --audience and --expires optional)
splunk-as security create-token -n "my-app-token"
splunk-as security create-token -n "my-app-token" --audience "my-app" --expires 2592000

# Delete token
splunk-as security delete-token token_123

# Get capabilities (current user)
splunk-as security capabilities
splunk-as security capabilities -o json

# Check if user has a specific capability (positional argument)
splunk-as security check search

# Get ACL (full REST path starting with /)
splunk-as security acl /servicesNS/nobody/search/saved/searches/MySearch
splunk-as security acl /servicesNS/nobody/search/saved/searches/MySearch -o json

API Endpoints

  • GET/POST/DELETE /services/authorization/tokens - Tokens
  • GET/POST /services/data/transforms/lookups/{name}/acl - ACL

splunk-tag

Knowledge object tags and field/value associations for Splunk.

Purpose

Add, remove, and manage tags associated with field values for easier searching.

Risk Levels

OperationRiskNotes
List tags-Read-only
Search by tag-Read-only
Add tag⚠️Easily reversible
Remove tag⚠️Easily reversible

Triggers

  • "tag", "label", "classify"
  • "tag field", "add tag"

CLI Commands

CommandDescription
tag addAdd tag to field value
tag removeRemove tag from field value
tag listList all tags
tag searchSearch using tag= syntax

Options

OptionCommandsDescription
-a, --applist, add, removeApp context (defaults to "search")
-o, --outputlist, searchOutput format (text, json)
-i, --indexsearchFilter by index
-e, --earliestsearchEarliest time (defaults to -24h)

Examples

# List all tags (with short flags)
splunk-as tag list
splunk-as tag list -a search -o json

# Add tag to field value (format: field::value tag_name)
splunk-as tag add host::webserver01 production
splunk-as tag add host::webserver01 production -a my_app

# Remove tag from field value
splunk-as tag remove host::webserver01 production
splunk-as tag remove host::webserver01 production -a my_app

# Search by tag (with short flags)
splunk-as tag search production
splunk-as tag search production -e -1h -i main
splunk-as tag search production -e -1h -o json

SPL Patterns

tag=web_traffic
tag::src_ip=internal

Commands 4

Splunk Assistant Skills Setup

You are helping the user set up Splunk Assistant Skills. This is a one-time setup that configures:

  1. A shared Python virtual environment at ~/.assistant-skills-venv/
  2. Required Python dependencies
  3. Splunk connection credentials (URL, authentication)
  4. A claude-as shell function for running Claude with the venv activated

Setup Process

Step 1: Create Python Virtual Environment

First, create the shared virtual environment:

python3 -m venv ~/.assistant-skills-venv

Step 2: Activate and Install Dependencies

Activate the venv and install the required packages:

source ~/.assistant-skills-venv/bin/activate && pip install --upgrade pip && pip install splunk-as

Step 3: Configure Splunk Credentials

Run the environment setup script to configure Splunk connection:

bash "${CLAUDE_PLUGIN_ROOT}/../../scripts/setup-env.sh"

This will prompt for:

  • Splunk URL (e.g., https://splunk.example.com)
  • Management port (default: 8089)
  • Authentication method (Bearer token or Basic auth)
  • Default app and index settings

Step 4: Create claude-as Shell Function

Add the claude-as function to the user's shell RC file. This function activates the venv before running Claude:

For bash users (~/.bashrc):

cat >> ~/.bashrc << 'EOF'

# Claude with Assistant Skills venv
claude-as() {
    source ~/.assistant-skills-venv/bin/activate
    claude "$@"
    deactivate
}
EOF

For zsh users (~/.zshrc):

cat >> ~/.zshrc << 'EOF'

# Claude with Assistant Skills venv
claude-as() {
    source ~/.assistant-skills-venv/bin/activate
    claude "$@"
    deactivate
}
EOF

Step 5: Verify Installation

Test that the setup is complete:

source ~/.assistant-skills-venv/bin/activate && python -c "from splunk_as import get_splunk_client; print('Library installed successfully')"

Important Notes

  • After setup, use claude-as instead of claude to run with the Assistant Skills venv activated
  • Credentials are stored in ~/.env with secure permissions (chmod 600)
  • To reconfigure credentials later, run the setup script again: bash "${CLAUDE_PLUGIN_ROOT}/../../scripts/setup-env.sh"
  • For profile-based configuration, see the CLAUDE.md documentation

Troubleshooting

If you encounter issues:

  1. Python not found: Ensure Python 3.8+ is installed
  2. Permission denied: Check that ~/.assistant-skills-venv is writable
  3. Connection failed: Verify Splunk URL and port are accessible
  4. Authentication failed: Check token validity or username/password

Browse Splunk Assistant Skills

Display all 14 available Splunk Assistant Skills with their purpose and trigger keywords.

Skill Catalog

SkillPurposeTriggers
splunk-assistantCentral hub and router - routes requests to specialized skillssplunk, search, query, SPL
splunk-searchSPL query execution (oneshot, normal, blocking modes)search, SPL, query, find, oneshot, blocking
splunk-jobSearch job lifecycle (create, monitor, pause, cancel)job, SID, status, progress, cancel, pause
splunk-exportHigh-volume streaming data extractionexport, download, extract, stream, ETL
splunk-metadataIndex, source, sourcetype discoverymetadata, index, source, sourcetype, fields
splunk-lookupCSV and lookup file managementlookup, CSV, upload, lookup table
splunk-kvstoreApp Key Value Store operationskvstore, collection, key-value, persist
splunk-savedsearchReports and scheduled searchessaved search, report, schedule
splunk-alertAlert triggering and monitoringalert, trigger, notification, monitor
splunk-appApplication managementapp, application, install, package
splunk-securityToken management, RBAC, ACLtoken, permission, ACL, RBAC, security
splunk-rest-adminREST API configuration accessrest, admin, config, server, settings
splunk-tagKnowledge object taggingtag, label, classify
splunk-metricsReal-time metrics (mstats, mcatalog)metrics, mstats, mcatalog, time series

Quick Start Commands

# Search
splunk-as search oneshot "index=main | head 10"
splunk-as search normal "index=main | stats count" --wait

# Jobs
splunk-as job list
splunk-as job status <SID>

# Metadata
splunk-as metadata indexes
splunk-as metadata sourcetypes --index main

# Administration
splunk-as admin info
splunk-as security whoami

Getting More Info

Use /skill-info <skill-name> to see detailed documentation for a specific skill.

Example: /skill-info splunk-search

Skill Information: {{ skill }}

Display detailed documentation for the specified Splunk Assistant skill.

Instructions

Read the SKILL.md file for the requested skill and present:

  1. Purpose: What the skill does
  2. Triggers: Keywords that activate this skill
  3. CLI Commands: Available splunk-as commands with examples
  4. API Endpoints: Underlying Splunk REST API endpoints
  5. Best Practices: Tips for effective usage
  6. Related Skills: Other skills that work together

Skill Location

The skill documentation is at: ${CLAUDE_PLUGIN_ROOT}/skills/{{ skill }}/SKILL.md

Available Skills

  • splunk-assistant
  • splunk-search
  • splunk-job
  • splunk-export
  • splunk-metadata
  • splunk-lookup
  • splunk-kvstore
  • splunk-savedsearch
  • splunk-alert
  • splunk-app
  • splunk-security
  • splunk-rest-admin
  • splunk-tag
  • splunk-metrics

If the skill name is not found, suggest similar skills from the list above.

Splunk Instance Discovery

Discover and display information about the connected Splunk instance.

Discovery Steps

Step 1: Verify Connection

Check connectivity to the Splunk Search Head on management port 8089:

splunk-as admin info

This returns:

  • Server version and build
  • Deployment type (Cloud vs on-prem)
  • Connection status
  • Current user and capabilities

Step 2: Check Server Health

splunk-as admin health

Step 3: List Available Indexes

splunk-as metadata indexes

Step 4: Check User Permissions

splunk-as security whoami

Expected Output

After running discovery, summarize:

  1. Connection Status: Connected/Not Connected
  2. Splunk Version: e.g., 9.1.0
  3. Deployment Type: Splunk Enterprise, Splunk Cloud, etc.
  4. Current User: Username and roles
  5. Available Indexes: List of accessible indexes
  6. Key Capabilities: What operations are permitted

Troubleshooting

If connection fails:

  • Verify SPLUNK_SITE_URL environment variable is set
  • Check SPLUNK_TOKEN or SPLUNK_USERNAME/SPLUNK_PASSWORD
  • Ensure port 8089 is accessible
  • Run /assistant-skills-setup to reconfigure

Sponsors

Details

Marketplace
grandcamel/Splunk-Assistant-Skills
Source
.
Author
grandcamel
Category
Productivity
Keywords
splunk, search, spl, siem, automation, devops, natural-language