<?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 How to create a dynamic dashboard that runs a search based on user input in a text field and drop-down selection? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-dynamic-dashboard-that-runs-a-search-based-on/m-p/204593#M59439</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Is there a way to create a search on the fly based on user input?&lt;/P&gt;

&lt;P&gt;What I have is a textfield and drop-down.&lt;/P&gt;

&lt;P&gt;User enters something in the textfield and selects a value from the dro-pdown.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Simple XML&amp;lt;/label&amp;gt;
  &amp;lt;description&amp;gt;My sample dashboard&amp;lt;/description&amp;gt;
  &amp;lt;fieldset submitButton="true"&amp;gt;
    &amp;lt;input type="text" token="searchText"&amp;gt;&amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="searchBy"&amp;gt;
      &amp;lt;label&amp;gt;Search By&amp;lt;/label&amp;gt;
      &amp;lt;choice value="1"&amp;gt;Foo&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="2"&amp;gt;Bar&amp;lt;/choice&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;title&amp;gt;Results&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=myIndex sourcetype=mySourceType Foo=$searchText$ | table Foo, Bar&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="showPager"&amp;gt;true&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;Let's say I am logging the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Foo=abcd, Bar=100
Foo=dcba, Bar=101
Foo=abcd, Bar=102
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When user enters "abcd" and selects Foo from the drop-down, then I need to run a search that will be like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myIndex sourcetype=mysourceType Foo=abcd | table Foo, Bar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And it should display 2 rows of data for Foo=abcd&lt;/P&gt;

&lt;P&gt;If user enters 100 and selects Bar, then the search has to be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myIndex sourcetype=mysourceType Bar=100 | table Foo, Bar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I do this?&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jun 2016 21:08:33 GMT</pubDate>
    <dc:creator>servlette</dc:creator>
    <dc:date>2016-06-08T21:08:33Z</dc:date>
    <item>
      <title>How to create a dynamic dashboard that runs a search based on user input in a text field and drop-down selection?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-dynamic-dashboard-that-runs-a-search-based-on/m-p/204593#M59439</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Is there a way to create a search on the fly based on user input?&lt;/P&gt;

&lt;P&gt;What I have is a textfield and drop-down.&lt;/P&gt;

&lt;P&gt;User enters something in the textfield and selects a value from the dro-pdown.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Simple XML&amp;lt;/label&amp;gt;
  &amp;lt;description&amp;gt;My sample dashboard&amp;lt;/description&amp;gt;
  &amp;lt;fieldset submitButton="true"&amp;gt;
    &amp;lt;input type="text" token="searchText"&amp;gt;&amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="searchBy"&amp;gt;
      &amp;lt;label&amp;gt;Search By&amp;lt;/label&amp;gt;
      &amp;lt;choice value="1"&amp;gt;Foo&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="2"&amp;gt;Bar&amp;lt;/choice&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;title&amp;gt;Results&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=myIndex sourcetype=mySourceType Foo=$searchText$ | table Foo, Bar&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="showPager"&amp;gt;true&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;Let's say I am logging the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Foo=abcd, Bar=100
Foo=dcba, Bar=101
Foo=abcd, Bar=102
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When user enters "abcd" and selects Foo from the drop-down, then I need to run a search that will be like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myIndex sourcetype=mysourceType Foo=abcd | table Foo, Bar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And it should display 2 rows of data for Foo=abcd&lt;/P&gt;

&lt;P&gt;If user enters 100 and selects Bar, then the search has to be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myIndex sourcetype=mysourceType Bar=100 | table Foo, Bar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How do I do this?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2016 21:08:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-dynamic-dashboard-that-runs-a-search-based-on/m-p/204593#M59439</guid>
      <dc:creator>servlette</dc:creator>
      <dc:date>2016-06-08T21:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic dashboard that runs a search based on user input in a text field and drop-down selection?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-dynamic-dashboard-that-runs-a-search-based-on/m-p/204594#M59440</link>
      <description>&lt;P&gt;Just update your panel search with this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=myIndex sourcetype=mySourceType $searchBy$=$searchText$ | table Foo Bar
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Jun 2016 21:49:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-dynamic-dashboard-that-runs-a-search-based-on/m-p/204594#M59440</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-08T21:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dynamic dashboard that runs a search based on user input in a text field and drop-down selection?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-dynamic-dashboard-that-runs-a-search-based-on/m-p/204595#M59441</link>
      <description>&lt;P&gt;How about using &lt;/P&gt;

&lt;P&gt;( Foo=$searchText$ OR Bar=$searchText$ )&lt;/P&gt;

&lt;P&gt;Or, maybe you can do input selection for two drop-downs ; one for Foo and the other for Bar. Then, you can use the similar query ;&lt;/P&gt;

&lt;P&gt;( Foo=$vaalue_foo$ OR Bar=$value_bar$ )&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:55:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-dynamic-dashboard-that-runs-a-search-based-on/m-p/204595#M59441</guid>
      <dc:creator>Masa</dc:creator>
      <dc:date>2020-09-29T09:55:13Z</dc:date>
    </item>
  </channel>
</rss>

