Splunk Dev

How to Modify 'splunkdConnectionTimeout' variable from my Splunk app?

priyanshuraj400
Explorer

Hello,

I have created a Splunk app and it is currently in marketplace. I am getting a timeout error while pulling data from my API into Splunk app. Upon investigation, I figured out that I need to increase 'splunkdConnectionTimeout' from 30 sec to a higher value, in `$ SPLUNK_HOME /lib /python3.7 /site-packages /splunk /rest /__ init__. py’, line number 52.

I want to modify this as and when the user installs my app, this modification should be applied upon restarting the splunk.

I tried doing this by using `web. conf` file in my app but I am not sure where and how to use this.

Please help me how can I do this.

Labels (4)
Tags (1)
0 Karma
1 Solution

VatsalJagani
SplunkTrust
SplunkTrust

@priyanshuraj400 - You need to add this parameter inside your App's web.conf manually.

View solution in original post

VatsalJagani
SplunkTrust
SplunkTrust

@priyanshuraj400 - I'm assuming you are using the `rest.simpleRequest` method.

In there, you can pass a parameter called timeout. For example

rest.simpleRequest(apiPath, sessionKey=mySessionKey, method='GET', timeout=None)

 

I hope this helps!!!

priyanshuraj400
Explorer

Hi @VatsalJagani,
Yes, that is what I want to set. If you look into `$ SPLUNK_HOME /lib /python3.7 /site-packages /splunk /rest /__ init__. py’, line number 52, you will find a parameter 'splunkdConnectionTimeout'

I believe if somehow I can set this parameter from outside, I will be able to increase the timeout.

Upon going through documentation, I found out 'web.conf' might be a way to do that.

https://docs.splunk.com/Documentation/Splunk/9.1.0/Admin/Webconf

in this documentation, you will find the 'splunkdConnectionTimeout' parameter.

But I am unable to figure out that how to use this config file through app. Basically I need to set this varibale timeout through my app only, there should be no external effort.

If there is any other way to do it, I am open to that also.

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

As I mentioned that timeout is for rest.simpleRequest() and not for the custom rest endpoint you might have in your App.

 

For setting that parameter for your custom Rest Handler, you can set it under web.conf under your Rest handler's stanza, you can add that parameter.

splunkdConnectionTimeout = 120

(For reference - https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-REST-API-execution-timeout/m-p/295...)

 

I hope this helps!!! Kindly upvote if it does!!!

priyanshuraj400
Explorer

I understand @VatsalJagani , but my question is, I have to set web.conf manually, right?
Is there any way that my app do that automatically?

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

@priyanshuraj400 - You need to add this parameter inside your App's web.conf manually.

Get Updates on the Splunk Community!

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

October 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Splunk Education Goes to Washington | Splunk GovSummit 2024

If you’re in the Washington, D.C. area, this is your opportunity to take your career and Splunk skills to the ...