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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...