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!

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 ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...