<?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 Can a variable value which depends on a dropdown token be included in search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-a-variable-value-which-depends-on-a-dropdown-token-be/m-p/480267#M134608</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;

&lt;P&gt;I am trying to assign a value to "myVar", which depends on a dropdown token on my dashboard. The value of "myVar" is used to search for a specific sourcetype. This is my current solution which does not work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="dev_analytics" OR index="live_analytics" | 
eval myVar=case($instance$==servertoserver-test,"flink_dev2",$instance$==servertoserver-prod,"s2sdatacollector") | 
where sourcetype==myVar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It works, if I just assign the specific value to "myVar" (eval myVar=="mySourcetype"). For specifc reasons, I can not do something like sourcetype=$instance$.&lt;/P&gt;

&lt;P&gt;Is there anything I can do to make my solution work?&lt;/P&gt;

&lt;P&gt;Thanks in advance and regards,&lt;BR /&gt;
Eric&lt;/P&gt;</description>
    <pubDate>Thu, 12 Sep 2019 14:28:07 GMT</pubDate>
    <dc:creator>efranke</dc:creator>
    <dc:date>2019-09-12T14:28:07Z</dc:date>
    <item>
      <title>Can a variable value which depends on a dropdown token be included in search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-a-variable-value-which-depends-on-a-dropdown-token-be/m-p/480267#M134608</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;

&lt;P&gt;I am trying to assign a value to "myVar", which depends on a dropdown token on my dashboard. The value of "myVar" is used to search for a specific sourcetype. This is my current solution which does not work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="dev_analytics" OR index="live_analytics" | 
eval myVar=case($instance$==servertoserver-test,"flink_dev2",$instance$==servertoserver-prod,"s2sdatacollector") | 
where sourcetype==myVar
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It works, if I just assign the specific value to "myVar" (eval myVar=="mySourcetype"). For specifc reasons, I can not do something like sourcetype=$instance$.&lt;/P&gt;

&lt;P&gt;Is there anything I can do to make my solution work?&lt;/P&gt;

&lt;P&gt;Thanks in advance and regards,&lt;BR /&gt;
Eric&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 14:28:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-a-variable-value-which-depends-on-a-dropdown-token-be/m-p/480267#M134608</guid>
      <dc:creator>efranke</dc:creator>
      <dc:date>2019-09-12T14:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: Can a variable value which depends on a dropdown token be included in search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-a-variable-value-which-depends-on-a-dropdown-token-be/m-p/480268#M134609</link>
      <description>&lt;P&gt;@efranke ,&lt;/P&gt;

&lt;P&gt;Set the value at the dropdown on change event.&lt;/P&gt;

&lt;P&gt;Here is an example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;efranke&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="instance"&amp;gt;
      &amp;lt;label&amp;gt;Instance&amp;lt;/label&amp;gt;
      &amp;lt;choice value="servertoserver-test"&amp;gt;servertoserver-test&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="servertoserver-prod"&amp;gt;servertoserver-prod&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;servertoserver-test&amp;lt;/default&amp;gt;
      &amp;lt;initialValue&amp;gt;servertoserver-test&amp;lt;/initialValue&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition value="servertoserver-test"&amp;gt;
          &amp;lt;set token="sourcetype"&amp;gt;flink_dev2&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition value="servertoserver-prod"&amp;gt;
          &amp;lt;set token="sourcetype"&amp;gt;s2sdatacollector&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&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;Result for $sourcetype$&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index="dev_analytics" OR index="live_analytics" sourcetype="$sourcetype$"&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&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;/table&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>Fri, 13 Sep 2019 03:45:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-a-variable-value-which-depends-on-a-dropdown-token-be/m-p/480268#M134609</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2019-09-13T03:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Can a variable value which depends on a dropdown token be included in search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-a-variable-value-which-depends-on-a-dropdown-token-be/m-p/480269#M134610</link>
      <description>&lt;P&gt;@renjith.nair&lt;/P&gt;

&lt;P&gt;Thank you, the solution works perfectly for me.&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Eric&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 05:56:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-a-variable-value-which-depends-on-a-dropdown-token-be/m-p/480269#M134610</guid>
      <dc:creator>efranke</dc:creator>
      <dc:date>2019-09-13T05:56:10Z</dc:date>
    </item>
  </channel>
</rss>

