Splunk Dev

splunk api slowness

BalajiRaju
Loves-to-Learn Everything

The use case of mine is to retrieve the data from splunk. I have written the python script to get the data from splunk using splunk rest api. But it takes too much of time to process it and give the response. Tried oneshot method also but no use. Please guide me is there any other alternate approach to get the data from splunk. kindly suggest.

0 Karma

marnall
Motivator

Are you using the API to dispatch and retrieve the results of a search? If so, does the search take roughly the same amount of time on its own?

0 Karma

PickleRick
SplunkTrust
SplunkTrust

With the level of vagueness in your question the only response is "something is wrong".

We don't know what your code looks like, we don't know your infrastructure, we don't know what results your script yields - both in terms of general return codes or errors from the whole script as well as any intermediate results.

It's hard to say anything with such little information.

0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @BalajiRaju 

Please could you try two things to see if this gives us any further information on what might be happening here.

Please could you run the same search in both Splunk UI and via REST API and compare the runtimes for the same search. Please post the timing differences.

Also, try a very basic search via the API such as 

 | makeresults | eval msg="HelloWorld"

How long does the makeresults command take?

Are you using the Splunk Python SDK, if so, which version? 

Please feel free to post code snippets and searches to help us look into this further.

Please let me know how you get on and consider adding karma to this or any other answer if it has helped.
Regards

Will

0 Karma

BalajiRaju
Loves-to-Learn Everything

@livehybrid Thanks for your reply

I couldn't execute the splunk query in the splunk rest api using python script. Getting error message while executing the job. job has failed.

| makeresults | eval msg="HelloWorld"

 i can execute it on splunk UI. It takes "This search has completed and has returned 1 results by scanning 0 events in 0.302 seconds". I 

0 Karma

livehybrid
SplunkTrust
SplunkTrust

Please can you share the Python code you used to execute the test query so that we can help diagnose.

Thanks

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...