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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...