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!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...