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!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...