Splunk Search

SplunkJS: How to check if the search is currently running with Javascript?

seva98
Path Finder

Hi,

I have an issue in my project code, something runs a function that starts multiple searches- multiple times.

I will need to make simple checks, where I check if a search with 'searchid' is currently running and if so I will just return else and start the search.
Is it possible?

For example, I will need something like this:

var search = mvc.Components.getInstance('searchid')
if (search.isRunning) {
 return
} else {
 // Start search
}

I know how to run the search but I don't know how to check if it is currently running.

Thanks!

0 Karma
1 Solution

DavidHourani
Super Champion

Hello @seva98,

Here's an example for you :
http://dev.splunk.com/view/webframework-codeexamples/SP-CAAAEVT

Let me know if that's what you're looking for !

Cheers,
David

View solution in original post

DavidHourani
Super Champion

Hello @seva98,

Here's an example for you :
http://dev.splunk.com/view/webframework-codeexamples/SP-CAAAEVT

Let me know if that's what you're looking for !

Cheers,
David

seva98
Path Finder

Great, thanks! I checked the properites and there is value I needed.

search.on('search:progress', function(properties){ console.log(properties.content.isDone) })

0 Karma

DavidHourani
Super Champion

Awesome ! glad to know it helped 🙂

0 Karma
Get Updates on the Splunk Community!

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

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...