Splunk Search

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

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

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

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