<?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: Different query's based on the result of previous Token in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Different-query-s-based-on-the-result-of-previous-Token/m-p/380050#M168958</link>
    <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;This can be achieve by a simple token you can use refer the below sample. &lt;/P&gt;

&lt;P&gt;Description:&lt;/P&gt;

&lt;P&gt;Token named "token" can be set to the search based on user selection. With this example i've used the internal index, you may want to try with your index. &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Note: This sample will run only you&lt;BR /&gt;
have access to internal index.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Sample&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="token" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Your Token&amp;lt;/label&amp;gt;
      &amp;lt;choice value="index=_internal | head 10 | stats c by host"&amp;gt;host&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="index=_internal | head 10 | stats c by sourcetype, host"&amp;gt;sourcetype, host&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="index=_internal | head 10 | stats c by source, host, sourcetype"&amp;gt;source, host, sourcetype&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;index=_internal | head 10 | stats c by host&amp;lt;/default&amp;gt;
      &amp;lt;initialValue&amp;gt;index=_internal | head 10 | stats c by host&amp;lt;/initialValue&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;$token$&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;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&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;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
V&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jun 2018 16:15:18 GMT</pubDate>
    <dc:creator>vasanthmss</dc:creator>
    <dc:date>2018-06-11T16:15:18Z</dc:date>
    <item>
      <title>Different query's based on the result of previous Token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-query-s-based-on-the-result-of-previous-Token/m-p/380049#M168957</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a doubt that I think it´s easy to respond, but until now, I have no results.&lt;BR /&gt;
I want to make an query that depends on the result of a token, example:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;If the token is set to yeallow, 

&lt;UL&gt;
&lt;LI&gt;then the following query will be executed: index=a | stats count by field.name1&lt;/LI&gt;
&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;If the token is set to red, 

&lt;UL&gt;
&lt;LI&gt;then the following query will be executed: index=b | stats count by field.name2, field.name4&lt;/LI&gt;
&lt;/UL&gt;&lt;/LI&gt;
&lt;LI&gt;If the toke is set to green, 

&lt;UL&gt;
&lt;LI&gt;then the following query will be executed: index=c | stats count by field.name3, field.name5, field.name6&lt;/LI&gt;
&lt;/UL&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;How can I achieve this?&lt;/P&gt;

&lt;P&gt;Thanks in advance.&lt;/P&gt;

&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 15:45:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-query-s-based-on-the-result-of-previous-Token/m-p/380049#M168957</guid>
      <dc:creator>splunk_exercice</dc:creator>
      <dc:date>2018-06-11T15:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Different query's based on the result of previous Token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-query-s-based-on-the-result-of-previous-Token/m-p/380050#M168958</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;This can be achieve by a simple token you can use refer the below sample. &lt;/P&gt;

&lt;P&gt;Description:&lt;/P&gt;

&lt;P&gt;Token named "token" can be set to the search based on user selection. With this example i've used the internal index, you may want to try with your index. &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;Note: This sample will run only you&lt;BR /&gt;
have access to internal index.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Sample&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="token" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Your Token&amp;lt;/label&amp;gt;
      &amp;lt;choice value="index=_internal | head 10 | stats c by host"&amp;gt;host&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="index=_internal | head 10 | stats c by sourcetype, host"&amp;gt;sourcetype, host&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="index=_internal | head 10 | stats c by source, host, sourcetype"&amp;gt;source, host, sourcetype&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;index=_internal | head 10 | stats c by host&amp;lt;/default&amp;gt;
      &amp;lt;initialValue&amp;gt;index=_internal | head 10 | stats c by host&amp;lt;/initialValue&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;$token$&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;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&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;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
V&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 16:15:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-query-s-based-on-the-result-of-previous-Token/m-p/380050#M168958</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2018-06-11T16:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Different query's based on the result of previous Token</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Different-query-s-based-on-the-result-of-previous-Token/m-p/380051#M168959</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Sample&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="selected" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Your Token&amp;lt;/label&amp;gt;
      &amp;lt;choice value="field.name1"&amp;gt;Yellow&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="field.name2, field.name4"&amp;gt;red&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="field.name3, field.name5, field.name6"&amp;gt;green&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;Yellow&amp;lt;/default&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;|stats count by $selected$&amp;lt;/title&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;|makeresults |eval tokenvalue="$selected$"&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="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jun 2018 06:26:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Different-query-s-based-on-the-result-of-previous-Token/m-p/380051#M168959</guid>
      <dc:creator>harishalipaka</dc:creator>
      <dc:date>2018-06-12T06:26:44Z</dc:date>
    </item>
  </channel>
</rss>

