Splunk Dev

Python SDK Best Practices

snayak_splunk
Splunk Employee
Splunk Employee

We are trying to develop an external application that pulls data from Splunk via the Python SDK.

We had a couple of questions.
whether we need to explicitly log-out of service calls (and if not what the implications are)

Service(_BaseService):
"""A Pythonic binding to Splunk instances

Do we need to explicitly logout of

self.service.logout()

we’re finding we’re needing to make a lot of splunk restarts to pick-up changes – any hints/tips/guidance on compiler interaction with Splunk (or even general Best Practice) would help!

Also, do we have some documented Best Practices for the Python SDK?

Any input would be greatly appreciated.

Tags (2)
0 Karma
1 Solution

sloshburch
Splunk Employee
Splunk Employee
  1. I think it was @mvanderlist_splunk who pointed out that the logout is not necessary since the session timeout should suffice and can be modified to constraint to your desired TTL.
  2. There are great tips on the _bump and /debug/refresh strategies, as well as how to customize other caching parameters that help minimize the need for any action documented at Customization options and caching. Just remember that if something doesn't seem to take effect through one of those approaches, always revert back to a classic restart rather than assuming it's broken - these approaches may not work 100% of all times you'd expect them to (simply because we expect too much lol).

View solution in original post

sloshburch
Splunk Employee
Splunk Employee
  1. I think it was @mvanderlist_splunk who pointed out that the logout is not necessary since the session timeout should suffice and can be modified to constraint to your desired TTL.
  2. There are great tips on the _bump and /debug/refresh strategies, as well as how to customize other caching parameters that help minimize the need for any action documented at Customization options and caching. Just remember that if something doesn't seem to take effect through one of those approaches, always revert back to a classic restart rather than assuming it's broken - these approaches may not work 100% of all times you'd expect them to (simply because we expect too much lol).

gjanders
SplunkTrust
SplunkTrust
0 Karma

sloshburch
Splunk Employee
Splunk Employee

Good catch @garethatiag - the period snuck in on the url. Should be fixed now.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...