Dashboards & Visualizations

console.log does not output - script breaks

bhawkins1
Communicator

Hi,

I have a reference dashboard script which is normally working. If I add console.log(); lines and _bump splunk, I expect to see output in chrome's console ( F12 ).

But I don't. Am I doing something wrong?

0 Karma
1 Solution

bhawkins1
Communicator

If written in the correct space, dashboard scripts do support console.log() calls, so if they aren't working, then either:

  • Your call to console.log() is in an invalid point in code, or
  • Your script is broken because of some other syntax error. Suggest checking the syntax with an IDE that will flag, for example, missing commas. vscode does this by default.

View solution in original post

bhawkins1
Communicator

If written in the correct space, dashboard scripts do support console.log() calls, so if they aren't working, then either:

  • Your call to console.log() is in an invalid point in code, or
  • Your script is broken because of some other syntax error. Suggest checking the syntax with an IDE that will flag, for example, missing commas. vscode does this by default.

lquinn
Contributor

Can we see some more of your script? I can't hink of a reason why console.log would not be working in this context.

bhawkins1
Communicator

@lquinn you're right, console.log()works in any legal context - the problem for me in this case was that the script which was working, silently began failing. Is there a way to debug/validate a dashboard script to find errors?

0 Karma

bhawkins1
Communicator

For future readers with my issue: I suggest opening your script in an IDE that will validate your JS. I used vscode to quickly find a missing ,, and my script began behaving again.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...