Splunk Dev

Specifying a TTL when creating a job via the API?

dart
Splunk Employee
Splunk Employee

Is it possible to create a search job with Splunk's Python SDK and specify the TTL?
In the same way as when using a saved search you can specify dispatch.ttl

1 Solution

araitz
Splunk Employee
Splunk Employee

It appears that you are looking for setttl method on the Job object:

https://github.com/splunk/splunk-sdk-python/blob/master/splunk/client.py

def setttl(self, value):
    self.post("control", action="setttl", ttl=value)

View solution in original post

araitz
Splunk Employee
Splunk Employee

It appears that you are looking for setttl method on the Job object:

https://github.com/splunk/splunk-sdk-python/blob/master/splunk/client.py

def setttl(self, value):
    self.post("control", action="setttl", ttl=value)

dart
Splunk Employee
Splunk Employee

This is possible:

import splunk.client as client
service = client.connect(**{'username':'admin','password':'changeme'})
service.parse('search index=*', parse_only=True)
job = service.jobs.create('search index=*',**{'timeout':'123456'})
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, ...