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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...