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!

See Splunk Platform & Observability Innovations at Cisco Live EMEA

Hi Splunkers, Learn about what’s next for Splunk Platform at Cisco Live EMEA.  Data silos are a big challenge ...

The OpenTelemetry Certified Associate (OTCA) Exam

What’s this OTCA exam? The Linux Foundation offers the OpenTelemetry Certified Associate (OTCA) credential to ...

From Manual to Agentic: Level Up Your SOC at Cisco Live

Welcome to the Era of the Agentic SOC   Are you tired of being a manual alert responder? The security ...