Getting Data In

How many times it executes splunk search and export using python rest api ?

poorni_p
Explorer

Hi all,
I am writing a python rest api script to search and export csv results to a location.
I got the session key for the below query.

     serviceContent=httplib2.Http.request(...)
     sessionkey = minidom.parseString(serviceContent).getElementsByTagName('sessionKey')[0].childNodes[0].nodeValue

And using this session key, i am writing a infinite while loop to execute search and import csv file

  while true:
           ...
         #splunk Search using the Session key and got job id here
         #Get results & Export to CSV statement here
         #time.sleep(60) statement here to run the search every minute
         ...

My query is how many times the while look will get executed with the Session key?

thanks in advance.

0 Karma

sloshburch
Ultra Champion

I can't validate this but I wonder if it would be defined by the sessionTimeout property of server.conf

[general]
sessionTimeout = <nonnegative integer>[s|m|h|d]
* The amount of time before a user session times out, expressed as a
  search-like time range.
* Examples include "24h" (24 hours), "3d" (3 days),
  "7200s" (7200 seconds, or two hours)
* Default: "1" (1 hour)

So if the session is active then it may never expire because I believe this is more about inactive sessions.

0 Karma

poorni_p
Explorer

@SloshBurch
Not sure about server.conf, but i guess this can be defined in Settings in the upper right-hand corner -> Server settings -> Click General settings -> Session timeout.

any thoughts ?

0 Karma

sloshburch
Ultra Champion

I believe we're talking about the same thing. I mentioned where it is in the conf file and I think you found where it is in the UI. Let's see if I can get some developers to peek at this as well.

0 Karma

jkat54
SplunkTrust
SplunkTrust

An infinite number of times?

0 Karma

sloshburch
Ultra Champion

I think the question is how long do session keys persist before getting expired.

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...