Splunk Dev

how to get status of search query using javascript ?

sfatnass
Contributor

Hi,

i use query search using javascript based on onshotsearch
http://dev.splunk.com/view/javascript-sdk/SP-CAAAEKZ

i want to get status on progress search or adding jobprogressindicator with javascript.

thx

0 Karma

renjith_nair
Legend
0 Karma

sfatnass
Contributor

Ok bave an example using a simple search and return progress result?

0 Karma

renjith_nair
Legend

Below is an example code for simple search and return progress but no oneshot.

http://dev.splunk.com/view/webframework-codeexamples/SP-CAAAEVT

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

sfatnass
Contributor

thx for reply but i tryed that and it don't work

i don't know what can i ask to load on progress

mysearch.on('search:progress', function(properties) {
            // Print just the event count from the search job
            console.log("IN PROGRESS.\nEvents so far:", properties.content.eventCount);
            document.getElementById("progresstext").innerHTML="In progress with " + properties.content.eventCount + " events...";
        });

here it used mysearch, but for a oneshotsearch what can i use, i tryed the service, the search ID but no result.

0 Karma

renjith_nair
Legend

Sorry. I have overlooked about oneshot. As per definition, it does not return any result until search completes. So it looks like you could only get the final result

Oneshot: A oneshot search is a blocking search that is scheduled to run immediately. Instead of returning a search job, this mode returns the results of the search once completed. Because this is a blocking search, the results are not available until the search has finished.

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...