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!

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...