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!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...