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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Think Like an Architect: Introducing the Splunk Certified Cybersecurity Defense ...

In cybersecurity, defenders respond to threats. Architects design the systems that stop them.    As ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...