Dashboards & Visualizations

Why doesn't Splunk acknowledge tokens set with JavaScript inside dashboard input tags?

pembleton
Path Finder

Hi,

I'm having a problem using tokens set with JavaScript inside my XML, specifically inside input tags.

I have a dashboard with tabs and I'm using js to set a token when I move between them.
Then I use the token in my dashboard queries so they'll run only when their respective tab is active.

All work's well for most queries, but for those inside an input tag, there's a problem: splunk doesn't acknowledge the token set within the js code. it does recognize tokens set within the xml.

js code that sets the token:

var tokens  = mvc.Components.getInstance("submmited");
tokens.set(tabToken, '');

dashboard xml:

<!-- Doesn't work! -->
<input>
<search>
<query>
index=$index$ sourcetype=$sourcetype$ $control_token$
</query>
</search>
</input>


<!-- Work! -->
<table>
<search>
<query>
index=$index$ sourcetype=$sourcetype$ $control_token$
</query>
</search>
</table>

This behavior repeats throughout the dashboard, so I don't think it is caused by a faulty query. (also it starts working immediately after expelling the control_token)

Any ideas on why might this occur?
thanks in advance.

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

Methinks you have a typo, try this:

var tokens  = mvc.Components.getInstance("submitted");
tokens.set(tabToken, '');

submitted with 2 t's and 1 m.

0 Karma

pembleton
Path Finder

the typo is only in my question, not in the source. sorry about that.
anyway i don't think the problem is in a typo.
like i said, the token does work on most queries just not inside an input tag.

0 Karma

rvisj
New Member

hi @alacercogitatus, did you find any solution or alternate to his problem, bcs I am facing the same problem.

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 ...