Dashboards & Visualizations

Can you use token values in HTML module for dashboards?

feickertmd
Communicator

I have heard that the HTML module would render token values. I can find nothing on how to do it. I tried this:

<h1>I KNOW WHO YOU ARE $Area$</h1>
</html>

What I get is this:

I KNOW WHO YOU ARE $Area$

Tags (2)
1 Solution

guilmxm
Influencer

Hi, yes you can use tokens in HTML views, quite easily.

For example, a view that would contain

<h1>My custom token is $foo$</h2>

Called with an uri like:

my_simple_xml_view?foo=bar

Will replace the token by the substitute value.

NB: In 6.1.x version, a bug has affected token substitution in href html, token were not substituted by expected values
This has been corrected in 6.2 (a workaround was to convert the view in html)

View solution in original post

0 Karma

feickertmd
Communicator

Okay, that explains it. We have 6.12

0 Karma

guilmxm
Influencer

Hi, yes you can use tokens in HTML views, quite easily.

For example, a view that would contain

<h1>My custom token is $foo$</h2>

Called with an uri like:

my_simple_xml_view?foo=bar

Will replace the token by the substitute value.

NB: In 6.1.x version, a bug has affected token substitution in href html, token were not substituted by expected values
This has been corrected in 6.2 (a workaround was to convert the view in html)

0 Karma

guilmxm
Influencer

Raghav2384
Motivator

Sideview Utils! Has ton of examples to achieve what you're looking for

0 Karma

feickertmd
Communicator

Is it 6.x compatible? The app page says 5.0

0 Karma

Raghav2384
Motivator

App might not, but the examples will give you an idea on how to reference.

0 Karma

somesoni2
Revered Legend

Do you have the token defined?

0 Karma

feickertmd
Communicator

Yes, its is defined in the code I posted

0 Karma

tom_frotscher
Builder

In the code you posted is no definition of the token.

<h1>I KNOW WHO YOU ARE $Area$</h1> </html>

It just asks for the token $Area$ and substitude by whatever is in this token. But you must have defined it before. For example by a text input, a dropdown list or a drilldown.
Can you use the token in an other situation? For example in the title of a panel or in a drilldown search.

0 Karma

feickertmd
Communicator

How weird, my glob of code has disappeared! Yes, I have it defined in a previous piece of code.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...