Splunk Search

REST calling last scheduled search

Jason
Motivator

Is there a way to have REST look up the latest results from a scheduled search and return them, not re-running the search? I'm looking to replicate behavior similar to calling a saved search from the dashboard.

How would you go about doing this?

Tags (4)
1 Solution

Lowell
Super Champion

Looks like you can make a call to:

https://splunkserver:8089/servicesNS/nobody/search/saved/searches/<your_search_name>/history

And from there you get a list of links to previous runs. Each of these links would include the search job id. And from there you should be able to pull the results just as you would any other search job that was dispatched with any other REST call.

Keep in my that you may only have "results" and not "events" depending on how you saved search is setup. (Of course, this is no different than if you had opened a previously run job from the Jobs page as well.)

Does that help?


Side Note: I found this my simply opening a browser to the following URL and doing some quick digging around. If you aren't aware of this, you can find a lot of helpful stuff this way:

https://splunkserver:8089/services

View solution in original post

Lowell
Super Champion

Looks like you can make a call to:

https://splunkserver:8089/servicesNS/nobody/search/saved/searches/<your_search_name>/history

And from there you get a list of links to previous runs. Each of these links would include the search job id. And from there you should be able to pull the results just as you would any other search job that was dispatched with any other REST call.

Keep in my that you may only have "results" and not "events" depending on how you saved search is setup. (Of course, this is no different than if you had opened a previously run job from the Jobs page as well.)

Does that help?


Side Note: I found this my simply opening a browser to the following URL and doing some quick digging around. If you aren't aware of this, you can find a lot of helpful stuff this way:

https://splunkserver:8089/services

Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...