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!

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...