Splunk Dev

Distributed Custom Streaming Command accessing KV Store on search head with Splunk Python SDK

FritzWittwer
Path Finder

I am implementing a streaming distributed custom command in python which needs to access the kv store on the search head where the command has been issued. The kv stores are to large to distribute them to the indexers and simple lookups are to slow.


To connect to the kv store with a REST call, I am using the to session_key authenticate. :

 

kwargs={}
kwargs["owner"] = "nobody"
kwargs["app"] = "search"
kwargs["host"] = "<hostname>"
self.headers = {'output_mode': 'json', 'count':10000}
self.connection
client.connect(token=self._metadata.searchinfo.session_key,**kwargs)

 


from then on I access the kvstore with kvs = self.connection.kvstore[.....] and result= kvs.data.query(........)

But the instance of the executed command on an indexer fails with a login failure as it gets  the session_key from the local session on the indexer which is not valid to connect to the search head.

Is it possible to execute a part of the command on the search head before it gets distribute and pass its result (the session_key) to all distributed executed instances?

Labels (3)
Tags (1)
0 Karma
Get Updates on the Splunk Community!

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...

Unleash Unified Security and Observability with Splunk Cloud Platform

     Now Available on Microsoft AzureOn Demand Now Step boldly into the AI revolution with enhanced security ...