Splunk Search

Can you launch a search from within a custom search command?

MarcHelou
New Member

Hello,
I have already created a custom search command, Can I launch from my python scripy a search that gets me values I need to continue my custom search command?
Not passing them as arguments but running a search inside the custom command script?

0 Karma

supersleepwalke
Communicator

I was also looking to answer this question. Much of the documentation that exists is for version 1 of the custom search command protocol, which was deprecated in Splunk 6.4.0. I posted an example here: https://answers.splunk.com/answers/434017/how-to-get-session-key-in-a-search-script-script-s.html#an...

0 Karma

micahkemp
Champion

You definitely can, and the key to that is passing your sessionKey to your custom search command so that it can pass said key back to the Splunk REST API. This answers post lays out the major components you're looking for:

https://answers.splunk.com/answers/434017/how-to-get-session-key-in-a-search-script-script-s.html

0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...