Dashboards & Visualizations

Why does loadjob savedsearch return artifacts from a failed job?

bhooker_axcient
Engager

I have a dashboard which loads the results of a saved search to speed up the load times.

The saved search is scheduled to run frequently, and keeps results from the past 7 or 8 searches in it's history.

Often times, the dashboard gets 0 results back from the loadjob command, and when I check the latest jobs, the most recent job status will be failed.  To fix it, I just manually delete the failed job and let it roll back to the previous Done job.

Documentation for loadjob has an ignore_running option, but I am not seeing a way to ignore failed jobs, which would be nice.

** As an aside, I have noticed that I can make the saved search fail if I repeatedly call loadjob from a search (hit search 7 or 8 times without letting it finish) while the job is running.  I suspect that something like this is happening due to dashboard loads while this job is running which causes the failed job.

Labels (1)

bhooker_axcient
Engager

On the dashboard, there were too many calls to loadjob with the savedsearch parameter.  I found that if a user loaded that page while the saved search had a job in progress, the job would fail.   

I corrected the problem by instead making the call once in the dashboard:

<search id="cached_results">
  <query>| loadjob savedsearch="my_job_name"</query>
  <done>
  <set token="tok_cached_result">$job.sid$</set>
  </done>
</search>

Then I can load those results each time I needed to reference them:

<search>
<query>| loadjob "$tok_cached_result$"</query>
...
</search>

I hope this helps someone!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...