Splunk Search

Running a custom command via cli

rabrahaham
Engager

Hello All,

We created a custom search on splunk which calculates a specific metric on all the servers that are part of the distributed search. I wanted to find out if its possible to run this custom search on splunk servers which are not part of the distributed search via GUI or CLI. when I try running 

/opt/splunk/bin/splunk search 'customsearchcommand inputs' -uri https://172.31.2.100:8089 (172.31.2.100 is not part of the distributed search) it says customsearchcommand not found. The custom search command is only present on the search head and it is working perfectly on all the distributed search peers without having the custom search defined there. 

 

Thanks

Labels (1)
0 Karma

The_Simko
Path Finder

What you are experience is how search operates.  
The Search Head, where your custom command exists, regularly sends its knowledge objects to the search peers. That way, when the Search Head requests a search, the peers use the knowledge objects provided by the search head.    

Since you went to a different indexer that is not a search peer of your search head, it will not have the search head's knowledge objects, and ergo, won't run your custom command. 

It's surprising that the custom search command functions directly at the CLI on the search peers at all. The KO transfer must be registering the object.  (possible that I'm butchering the terms here).  

Solution, package your custom command into an app and load that app on the indexers you want to run the command on.

0 Karma
Get Updates on the Splunk Community!

Wrapping Up Cybersecurity Awareness Month

October might be wrapping up, but for Splunk Education, cybersecurity awareness never goes out of season. ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

🗣 You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...

What's New in Splunk Observability - October 2025

What’s New?    We’re excited to announce the latest enhancements to Splunk Observability Cloud and share ...