Knowledge Management

Is there a way to capture results from on(data) event into a global variable in splunkjs ?

harithivakarnad
New Member

I have a button on my HTML dashboard. I need to display some details from a search event on click of that button, but the issue here is am unable to get the data from data event into a global variable.

Below is the reference code:
var mysearch=splunkjs.mvc.Components.getInstance("search1");
var myResults = mysearch.data('results',{
output_mode: 'json',
count: 0
});
var resultdata=[];
myResults.on("data",function(){
resultdata=myResults.collection().toJSON();
});

Tags (1)
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Now On-Demand Join us to learn more about how you can leverage Service Level Objectives (SLOs) and the new ...

Database Performance Sidebar Panel Now on APM Database Query Performance & Service ...

We’ve streamlined the troubleshooting experience for database-related service issues by adding a database ...

IM Landing Page Filter - Now Available

We’ve added the capability for you to filter across the summary details on the main Infrastructure Monitoring ...