Splunk Enterprise

Javascript after upgrade Splunk 9.0.6

alvesri
Engager

Hello Guys,

I have weird problem with Javascript after the latest upgrade(8.2.8 to 9.0.6).

Javascript Code

 

 

var queryResults = smAlerteGetter.data("results");
             console.log("Search done", queryResults);
             console.log("pimba - ----   "  + JSON.stringify(queryResults));

// when we have the result
queryResults.on("data", function() 
{
console.log("Data received");

 

 


We should received the events and should see the log "Data received".
The query goes well and we can see in the Activity Jobs that we received our events.

However we have other splunk apps with similar scripts that have the correct behavior.

Do we miss something in our app or configurations related to Javascript ?
Please help!

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@alvesri 

It should work. Can you please just compare your code with my code.

var mySearch = mvc.Components.get("mySearch");
        var mySearchResults = mySearch.data("results");
        mySearchResults.on("data", function () {
            resultArray = mySearchResults.data().rows;
            // Iterate Result set 
            $.each(resultArray, function (index, value) {
                console.log(index, value)
                console.log(index, value[0])
                console.log(index, value[1])
                console.log(index, value[2])
            })
        });

 

I hope this will help you.

Thanks
KV
If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.

 

0 Karma

alvesri
Engager

First of all @kamlesh_vaghela Thank you so much for trying to help,
But we can't enter in:

 mySearchResults.on("data", function () {
            resultArray = mySearchResults.data().rows;
            // Iterate Result set 
            $.each(resultArray, function (index, value) {
                console.log(index, value)
                console.log(index, value[0])
                console.log(index, value[1])
                console.log(index, value[2])
            })
        });

 

 We can get the action and the results of this Data.

Thanks again

0 Karma
Get Updates on the Splunk Community!

Exporting Splunk Apps

Join us on Monday, October 21 at 11 am PT | 2 pm ET!With the app export functionality, app developers and ...

Cisco Use Cases, ITSI Best Practices, and More New Articles from Splunk Lantern

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

Build Your First SPL2 App!

Watch the recording now!.Do you want to SPL™, too? SPL2, Splunk's next-generation data search and preparation ...