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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...