<?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: Use eval to reference a $token$ in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Use-eval-to-reference-a-token/m-p/202558#M12717</link>
    <description>&lt;P&gt;Thanks exactly what I needed!&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2016 09:47:02 GMT</pubDate>
    <dc:creator>mansel_scheffel</dc:creator>
    <dc:date>2016-11-02T09:47:02Z</dc:date>
    <item>
      <title>Use eval to reference a $token$</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Use-eval-to-reference-a-token/m-p/202556#M12715</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a dashboard that is populated by an input.. It selects the index.. I am using the following search based on that to populate a dashboard:&lt;/P&gt;

&lt;P&gt;index=_internal source=&lt;EM&gt;license_usage.log type=Usage pool=&lt;/EM&gt; | stats sum(b) as b by idx | eval GB's=round((b) /1000/1000/1000,2) | rename idx as Index | fields Index GB's | sort 20 - GB's&lt;/P&gt;

&lt;P&gt;I want it to select whichever index the user chooses in the input.. So I need to use eval to make idx=$index_name$ or something to reference the right idx from the log by using the input dropdown.&lt;/P&gt;

&lt;P&gt;Any thoughts? &lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:38:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Use-eval-to-reference-a-token/m-p/202556#M12715</guid>
      <dc:creator>mansel_scheffel</dc:creator>
      <dc:date>2020-09-29T11:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Use eval to reference a $token$</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Use-eval-to-reference-a-token/m-p/202557#M12716</link>
      <description>&lt;P&gt;If I get it correct you want to be able to have the user to select a value from a input field (dropdown, etc) and then limit the results of your search to the selected value for &lt;CODE&gt;idx&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;First, you should create a input, that only lets the user select valid fields for idx. In your case (internal license usage) this would be the following XML code for a dropdown selector:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;input type="dropdown" token="token_idx"&amp;gt;
  &amp;lt;label&amp;gt;IDX&amp;lt;/label&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;index=_internal source=*license_usage.log | fields idx | dedup idx&amp;lt;/query&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldForLabel&amp;gt;idx&amp;lt;/fieldForLabel&amp;gt;
  &amp;lt;fieldForValue&amp;gt;idx&amp;lt;/fieldForValue&amp;gt;
 &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then you can integrate the selected value by integrating the &lt;CODE&gt;$token_idx$&lt;/CODE&gt; token into your search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=_internal source=*license_usage.log type=Usage idx=$token_idx$| stats sum(b) as b by idx | eval GB's=round((b) /1000/1000/1000,2) | rename idx as Index | fields Index GB's | sort 20 - GB's
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 Nov 2016 09:41:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Use-eval-to-reference-a-token/m-p/202557#M12716</guid>
      <dc:creator>DMohn</dc:creator>
      <dc:date>2016-11-02T09:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Use eval to reference a $token$</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Use-eval-to-reference-a-token/m-p/202558#M12717</link>
      <description>&lt;P&gt;Thanks exactly what I needed!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 09:47:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Use-eval-to-reference-a-token/m-p/202558#M12717</guid>
      <dc:creator>mansel_scheffel</dc:creator>
      <dc:date>2016-11-02T09:47:02Z</dc:date>
    </item>
  </channel>
</rss>

