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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...