<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Handling splunk dashboard token in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503416#M33002</link>
    <description>&lt;P&gt;@gaurav_maniar Thanks for your answer, its working well.Thank you very much&lt;/P&gt;</description>
    <pubDate>Fri, 25 Oct 2019 11:28:15 GMT</pubDate>
    <dc:creator>kranthimutyala</dc:creator>
    <dc:date>2019-10-25T11:28:15Z</dc:date>
    <item>
      <title>Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503406#M32992</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I have a dashboard which contains 2 inputs(both are text  fields ).But the user can give the values in both the text fields or he can give only in one of the text fields leaving the other one blank(but the query in the panel doesn't work if any of the  token is null)&lt;/P&gt;

&lt;P&gt;So when he gives the input in first field the second should be * and vice versa.&lt;BR /&gt;
But i do want to show the *  in the text box by setting up it in the default value&lt;/P&gt;

&lt;P&gt;Or how can i ignore the second token(assuming nothing is provided) in the panel search query so that it can generate the results based on one token&lt;/P&gt;

&lt;P&gt;Sample query in the panel : &lt;STRONG&gt;index=abc event=$token1$ agent=$token2$ | table action object&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Can someone help me on how to handle this situation.&lt;/P&gt;

&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 12:03:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503406#M32992</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2019-10-23T12:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503407#M32993</link>
      <description>&lt;P&gt;Set the default value for both text fields to &lt;CODE&gt;*&lt;/CODE&gt;.&lt;BR /&gt;
Your issue is that the token is unset when nothing is entered in.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 12:28:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503407#M32993</guid>
      <dc:creator>tomawest</dc:creator>
      <dc:date>2019-10-23T12:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503408#M32994</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;below code will resolve your issue,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text" token="tok2"&amp;gt;
    &amp;lt;label&amp;gt;field2&amp;lt;/label&amp;gt;
    &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Accept and upvote the answer if it helps.&lt;/P&gt;

&lt;P&gt;happy splunking........!!!!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 13:51:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503408#M32994</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-10-23T13:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503409#M32995</link>
      <description>&lt;P&gt;This will show (*) as default values but i want to hide it in the back bot showing up to the user&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2019 14:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503409#M32995</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2019-10-23T14:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503410#M32996</link>
      <description>&lt;P&gt;Hi , Try below . Give space in default.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
  &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Oct 2019 15:24:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503410#M32996</guid>
      <dc:creator>Anantha123</dc:creator>
      <dc:date>2019-10-23T15:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503411#M32997</link>
      <description>&lt;P&gt;thats not working&lt;/P&gt;</description>
      <pubDate>Thu, 24 Oct 2019 04:12:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503411#M32997</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2019-10-24T04:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503412#M32998</link>
      <description>&lt;P&gt;Please find the below code.In the below code whenever user doesn't specify any value for either source/log_level it must be replaced with *.&lt;BR /&gt;
 But i don't want to use * in default value as user doesn't want to see that.So need your help in handling this token whenever it is null change it to * internally using eval.Thank you&lt;/P&gt;

&lt;P&gt;input_test&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text" token="src"&amp;gt;
  &amp;lt;label&amp;gt;specify source&amp;lt;/label&amp;gt;
&amp;lt;/input&amp;gt;
&amp;lt;input type="text" token="log"&amp;gt;
  &amp;lt;label&amp;gt;log_level&amp;lt;/label&amp;gt;
&amp;lt;/input&amp;gt;
&amp;lt;input type="time" token="field1"&amp;gt;
  &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
  &amp;lt;default&amp;gt;
    &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
  &amp;lt;/default&amp;gt;
&amp;lt;/input&amp;gt;


&amp;lt;panel&amp;gt;
  &amp;lt;table&amp;gt;
    &amp;lt;search&amp;gt;
      &amp;lt;query&amp;gt;index=_internal sourcetype=$src$ log_level=$log$|table sourcetype log_level&amp;lt;/query&amp;gt;
      &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
      &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
    &amp;lt;/search&amp;gt;
    &amp;lt;option name="count"&amp;gt;10&amp;lt;/option&amp;gt;
    &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
    &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
  &amp;lt;/table&amp;gt;
&amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Oct 2019 04:13:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503412#M32998</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2019-10-24T04:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503413#M32999</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;If your are fine with using javascript, below code will work,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form script="default_token.js"&amp;gt;
  &amp;lt;label&amp;gt;Default Token&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="true"&amp;gt;
    &amp;lt;input type="text" token="token1"&amp;gt;
      &amp;lt;label&amp;gt;Field&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Default Token&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=$token1$ | head 1 | table _time, _raw&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;default_token.js&lt;/STRONG&gt;&lt;BR /&gt;
    require([&lt;BR /&gt;
        'underscore',&lt;BR /&gt;
        'jquery',&lt;BR /&gt;
        'splunkjs/mvc',&lt;BR /&gt;
        'splunkjs/mvc/tableview',&lt;BR /&gt;
        'splunkjs/mvc/searchmanager',&lt;BR /&gt;
        'splunkjs/mvc/simplexml/ready!'&lt;BR /&gt;
    ], function(_, $, mvc, TableView, SearchManager) {&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    var tokens = mvc.Components.get("default");

    $(document).on("click", "#submit", function(e){
        var tok1 = tokens.get("token1");

        if (tok1 == undefined || tok1 == ""){
            tokens.set("token1", "*");
        }
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Oct 2019 08:51:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503413#M32999</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-10-24T08:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503414#M33000</link>
      <description>&lt;P&gt;require([&lt;BR /&gt;
'underscore',&lt;BR /&gt;
'jquery',&lt;BR /&gt;
'splunkjs/mvc',&lt;BR /&gt;
'splunkjs/mvc/tableview',&lt;BR /&gt;
'splunkjs/mvc/searchmanager',&lt;BR /&gt;
'splunkjs/mvc/simplexml/ready!'&lt;BR /&gt;
], function(_, $, mvc, TableView, SearchManager) {&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; var tokens = mvc.Components.get("default");

 $(document).on("click", "#submit", function(e){
     var tok1 = tokens.get("token1");

     if (tok1 == undefined || tok1 == ""){
         tokens.set("token1", "*");
     }
 });

 $(document).on("click", "#submit", function(e){
     var tok2 = tokens.get("token1");

     if (tok2 == undefined || tok2 == ""){
         tokens.set("token2", "*");
     }
 });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;});&lt;/P&gt;

&lt;P&gt;this code is not working , i want to implement this for two tokens&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 09:54:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503414#M33000</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2019-10-25T09:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503415#M33001</link>
      <description>&lt;P&gt;$(document).on("click", "#submit", function(e){&lt;BR /&gt;
         var tok2 = tokens.get("token2");&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     if (tok2 == undefined || tok2 == ""){
         tokens.set("token2", "*");
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have added this snippet for token2, but its not working .Can you please help me with the script for more than one token change&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 09:56:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503415#M33001</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2019-10-25T09:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Handling splunk dashboard token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503416#M33002</link>
      <description>&lt;P&gt;@gaurav_maniar Thanks for your answer, its working well.Thank you very much&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 11:28:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Handling-splunk-dashboard-token/m-p/503416#M33002</guid>
      <dc:creator>kranthimutyala</dc:creator>
      <dc:date>2019-10-25T11:28:15Z</dc:date>
    </item>
  </channel>
</rss>

