Dashboards & Visualizations

Howto report javascript compilation errors in Simple-XML dashboard script

abramble
Explorer

Runtime errors from custom javascript executing on a simple-xml dashboard page are obvious in the console. However - nothing is reported if the custom javascript fails to compile.

Is there a way to configure splunk to report failed script includes when used in a simple xml dashboard? eg (script could not be loaded 404, or script does not compile)

<dashboard script="custom.js">
  <label>JS Example</label>
  <row>
    <panel id="example">
      <table>
        <title>Adjusted by custom.js</title>
        <search>
          <query>index=blah | stats count by foo</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</dashboard>
0 Karma

niketn
Legend

@abramble, 404 error is displayed in Console Viewer in Browser Inspector. While testing a JavaScript code you can try placing several console.log to ensure that whether a section of code executed or not. A console.log("Start Script") at the beginning will tell that script did not execute at all.

You should also check out Splunk Dev Site for Splunk JS Debugging options: http://dev.splunk.com/view/webframework-developapps/SP-CAAAEMZ

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

abramble
Explorer

Thanks @niketnilay - I've certainly used that strategy to determine that a script is NOT compiling - but it's not nearly as helpful as a real syntax error from the compiler.

Apologies also - I had overlooked the 404 case , it does indeed indicate in the UI with a !Warn banner.

I'd missed the documentation for mvc debugger. Thanks again.

0 Karma

niketn
Legend

@aramble, you can add Feature Request at the beginning of the subject to your question and also as tag to the question. While this feature is currently unavailable hopefully soon Splunk would be able to address this. Fingers Crossed 🙂

If you have Splunk Entitlement you can reach out to Splunk Support with the same.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Index This | How many sevens are there between 1 and 100?

August 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Enhance Security Operations with Automated Threat Analysis in the Splunk EcosystemAre you leveraging ...

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...