Reporting

How to call scheduled saved search from java sdk

bubby248
New Member

Hi

I am planning to call a scheduled saved search from java
SavedSearch savedSearch = service.getSavedSearches().get("mysavedsearch");

Job[] jobColl=null;
jobColl =savedSearch.history();

How can I get the last run job results from here.

Thanks

Tags (1)
0 Karma

Neeraj_Luthra
Splunk Employee
Splunk Employee

If the jobColl is not empty, then the first element in the array will be the most recent run.

SavedSearch savedSearch = service.getSavedSearches().get("mysavedsearch");
Job[] jobColl =savedSearch.history();
Job job;
if (jobColl.length > 0) {
// get the most recent run
job = jobColl[0];
} else {
job = savedSearch.dispatch();
}

0 Karma

kicksammy
Explorer

i m not getting the results... because the search has stats count in the search. how to fix it

0 Karma

bubby248
New Member

Yes.Thanks for clarification

0 Karma

Neeraj_Luthra
Splunk Employee
Splunk Employee

job.cancel() will remove that particular job from the saved search's history ... if that's what you are asking.

0 Karma

bubby248
New Member

Thanks.
Am using job.cancel(), after this operation.Does this remove the scheduled saved search from the history?

0 Karma
Get Updates on the Splunk Community!

Splunkbase | Splunk Dashboard Examples App for SimpleXML End of Life

The Splunk Dashboard Examples App for SimpleXML will reach end of support on Dec 19, 2024, after which no new ...

Understanding Generative AI Techniques and Their Application in Cybersecurity

Watch On-Demand Artificial intelligence is the talk of the town nowadays, with industries of all kinds ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...