Dashboards & Visualizations

How to initialize a token value

anooshac
Communicator

Hello all,
I want to initialize a token value. That is while dashboard is opened that value should be initialized to the token. I have tried writing the token value inside "init". I want to compute the token value in the "init" method, i tried and there is no change. How can i achieve this?

Tags (3)
0 Karma
1 Solution

vnravikumar
Champion

Hi

Check this

<dashboard>
  <label>init</label>
  <init>
    <eval token="temp">1+2</eval>
  </init>
  <row>
    <html>
      $temp$
    </html>
  </row>
</dashboard>

Please post your xml.

[updated]

Try by getting the max number in query and set it in a token.

<dashboard>
   <label>max number</label>
   <search>
     <query>
       | makeresults 
 | eval temp="12,33,444,66" 
 | makemv delim="," temp 
 | stats max(temp) as num

     </query>
     <done>
       <set token="max_num">$result.num$</set>
     </done>
   </search>
   <row>
     <html>
       maximum number: $max_num$
     </html>
   </row>
 </dashboard>

View solution in original post

anooshac
Communicator

HI @vnravikumar , can i use where command to print the fields which of $max_num$?
I have tried it and not getting any result. My file is in json format.

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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...