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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...