Splunk Search

How to increase execution speed of multiples searches in Splunk JavaScript Web Framework?

umairahmad3985
Path Finder

Hi all,

I have developed an app that has a custom dashboard. On that custom dashboard, I am using Splunk's JavaScript Web Framework to run my custom searches that call our external REST API and then the dashboard is rendered using results returned from those searches.

Specifically, I'm using the Search Manager to define and process results from my searches. The code structure that I'm following for each search is as follows:

 

var phishInc = new SearchManager({
        id: "phishing_inc",
        preview: true,
        cache: true,
        search: "| snxusers stat=phishing_breakdown globalFilterValue=$globalFilterValue$"
    }, {tokens: true});

    phishInc.on('search:failed', function(properties) {
           
    });

    phishInc.on('search:progress', function(properties) {
           
    });

    phishInc.on('search:done', function(properties) {
           
    });

    var phishing_inc_search = splunkjs.mvc.Components.get('phishing_inc');
    var phishing_inc_results = phishing_inc_search.data("results", {count: 0, output_mode: 'json_rows'});

    phishing_inc_results.on("data", function () {
      // The data from the search is processed here
    });

 

$globalFilterValue$ is a token that I have defined whose value I set from a drop-down menu. Whenever I set its value, my searches are triggered automatically as I have set tokens: true 

Now I have observed that for a single search only, the results are returned pretty quickly but when I define all of my searches  (total = 15) their times add up and the complete dashboard is rendered slowly. Since all of those searches depend on the globalFilterValue token, they are probably running in a sequential manner due to which the last parts of the dashboard are rendered at the end. Is there any way to speed up the execution of all these searches by somehow running them in a parallel fashion? Does Splunk JavaScript Web Framework allow any such possibility?

0 Karma
Get Updates on the Splunk Community!

Learn Splunk Insider Insights, Do More With Gen AI, & Find 20+ New Use Cases You Can ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Buttercup Games: Further Dashboarding Techniques (Part 7)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Stay Connected: Your Guide to April Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...