Splunk Enterprise

Splunk API- Is there a way to retrieve what time range does a search use?

latifismail
Engager

Is there a way to retrieve what time range does a search use?,

I have tried using this endpoint

curl -k -u admin:pass https://localhost:8089/services/saved/searches/search_name/history

but i guess it is not returning its time range

Thank you

Labels (1)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust

Hi

You could try something like this

| rest /servicesNS/-/-/saved/searches/Name%20Of%20search f=title f=dispatch.earliest_time f=dispatch.latest_time f=auto_summarize.cron_schedule f=search f=next_scheduled_time
```| transpose```

Last transpose helps (w/o comment characters) to see what all field that query results.

Of course you could run this also on command line with curl.

r. Ismo 

View solution in original post

isoutamo
SplunkTrust
SplunkTrust

Hi

You could try something like this

| rest /servicesNS/-/-/saved/searches/Name%20Of%20search f=title f=dispatch.earliest_time f=dispatch.latest_time f=auto_summarize.cron_schedule f=search f=next_scheduled_time
```| transpose```

Last transpose helps (w/o comment characters) to see what all field that query results.

Of course you could run this also on command line with curl.

r. Ismo 

Get Updates on the Splunk Community!

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...