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!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...