Dashboards & Visualizations

JavaScript code receiving erroneous information from Splunk Query

adnankhan5133
Communicator

We’re encountering an odd issue with regards to how our Splunk Dashboard query is passing values to the JavaScript code being invoked within the dashboard’s source code.

To provide you with an example, our dashboard SPL query is generating the correct values. Here is a sample output:

Transaction NameJune 2020 - CountJuly 2020 - CountAugust 2020 - Count
Employee Batch240032002900
Supervisor Batch210028002500

 

However, the JavaScript file is correctly picking up all the values except for the last column’s values, which it receives as a value of “0” from the Splunk query.

Transaction NameJune 2020 - CountJuly 2020 - CountAugust 2020 - Count
Employee Batch240032000
Supervisor Batch210028000

 

This results in the dashboard displaying the values captured by the JavaScript code, which makes the last column display the incorrect data.

Transaction NameJune 2020 - CountJuly 2020 - CountAugust 2020 - Count
Employee Batch240032000
Supervisor Batch210028000

 

There does not appear to be any hard-coding of values in the SPL query, so we’re rather confused as to how or why the JavaScript code would misinterpret the values of just one column, while correctly interpreting the values of all the other columns.

Would you have any ideas on how to proceed here? We tried researching this issue online but were unable to identify any helpful information.

Labels (3)
0 Karma

niketn
Legend

@adnankhan5133 for the community to assist you better can you please add details of what you SPL you have in SimpleXML vs what is your code for SearchManager in the JS? Also the user case for running Search through JS instead of SimpleXML?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

adnankhan5133
Communicator

For reference, included below is the current JavaScript code which is written to only get an instance of the search query and not manipulate data in any manner.

While looking through myResults, the following is what we received for 8/13. Index 12 for both Rows 0 and 1 are indicating a value of 0 for the row, rather than a non-zero value. The data that I included in my original question included mocked up data.

The question that we are trying to answer here is why Index 12 is picking up a value of zero rather than a non-zero value. 

The use case for leveraging JS alongside Splunk here is because we need to color-code certain cells that fall within or outside a certain threshold. While we could use the dashboard's in-line SimpleXML source code and hard-code the values, we are trying to achieve this via a more programmatic approach and JS appears to have been helping out so far.

JS_return.PNGJS_call.PNG

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...