<?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 Select the right index based on value in Dropdown in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Select-the-right-index-based-on-value-in-Dropdown/m-p/658906#M227563</link>
    <description>&lt;P&gt;I have a dropdown with two values PROD and TEST. Based on my selection in my panels in the dashboard I have to choose a different index for my search. How can I do this?&lt;/P&gt;&lt;P&gt;Example of two searches: (which also includes other tokens. These can be ignored. Both searches work if I directly put in the right index&lt;/P&gt;&lt;P&gt;1/&amp;nbsp;&lt;BR /&gt;index=&lt;STRONG&gt;&lt;EM&gt;&amp;lt;IF PROD then AAA_prod_index else AAA_test_index&amp;gt;&lt;/EM&gt;&lt;/STRONG&gt; sourcetype IN (abc:edge:api, abc:edge:api)&amp;nbsp; proxy!="ow*" $client_token$ $target_token$ |&lt;BR /&gt;rex mode=sed field=proxy "s#^(.*?)_(.*)$#*_\2#" | stats count by proxy&lt;/P&gt;&lt;P&gt;2/&lt;BR /&gt;index=&lt;STRONG&gt;&lt;EM&gt;&amp;lt;IF PROD then BBB_prod_index else BBB_test_index&amp;gt;&lt;/EM&gt;&lt;/STRONG&gt; sourcetype=accesslog&amp;nbsp; tenant=$tenant_token$ | stats count by HTTPStatusCode&lt;/P&gt;</description>
    <pubDate>Wed, 27 Sep 2023 21:07:13 GMT</pubDate>
    <dc:creator>sandmountain</dc:creator>
    <dc:date>2023-09-27T21:07:13Z</dc:date>
    <item>
      <title>Select the right index based on value in Dropdown</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Select-the-right-index-based-on-value-in-Dropdown/m-p/658906#M227563</link>
      <description>&lt;P&gt;I have a dropdown with two values PROD and TEST. Based on my selection in my panels in the dashboard I have to choose a different index for my search. How can I do this?&lt;/P&gt;&lt;P&gt;Example of two searches: (which also includes other tokens. These can be ignored. Both searches work if I directly put in the right index&lt;/P&gt;&lt;P&gt;1/&amp;nbsp;&lt;BR /&gt;index=&lt;STRONG&gt;&lt;EM&gt;&amp;lt;IF PROD then AAA_prod_index else AAA_test_index&amp;gt;&lt;/EM&gt;&lt;/STRONG&gt; sourcetype IN (abc:edge:api, abc:edge:api)&amp;nbsp; proxy!="ow*" $client_token$ $target_token$ |&lt;BR /&gt;rex mode=sed field=proxy "s#^(.*?)_(.*)$#*_\2#" | stats count by proxy&lt;/P&gt;&lt;P&gt;2/&lt;BR /&gt;index=&lt;STRONG&gt;&lt;EM&gt;&amp;lt;IF PROD then BBB_prod_index else BBB_test_index&amp;gt;&lt;/EM&gt;&lt;/STRONG&gt; sourcetype=accesslog&amp;nbsp; tenant=$tenant_token$ | stats count by HTTPStatusCode&lt;/P&gt;</description>
      <pubDate>Wed, 27 Sep 2023 21:07:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Select-the-right-index-based-on-value-in-Dropdown/m-p/658906#M227563</guid>
      <dc:creator>sandmountain</dc:creator>
      <dc:date>2023-09-27T21:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Select the right index based on value in Dropdown</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Select-the-right-index-based-on-value-in-Dropdown/m-p/658916#M227566</link>
      <description>&lt;P&gt;Your dropdown token, for example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;input type="dropdown" token="environment"&amp;gt;
  &amp;lt;label&amp;gt;Environment&amp;lt;/label&amp;gt;
  &amp;lt;choice value="prod"&amp;gt;PROD&amp;lt;/choice&amp;gt;
  &amp;lt;choice value="test"&amp;gt;TEST&amp;lt;/choice&amp;gt;
&amp;lt;/input&amp;gt;
...&lt;/LI-CODE&gt;&lt;P&gt;and then the searches just use that token&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=AAA_$environment$_index sourcetype IN (abc:edge:api, abc:edge:api)  proxy!="ow*" $client_token$ $target_token$ |
rex mode=sed field=proxy "s#^(.*?)_(.*)$#*_\2#" | stats count by proxy
----
index=BBB_$environment$_index sourcetype=accesslog  tenant=$tenant_token$ | stats count by HTTPStatusCode&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 27 Sep 2023 22:08:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Select-the-right-index-based-on-value-in-Dropdown/m-p/658916#M227566</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-09-27T22:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Select the right index based on value in Dropdown</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Select-the-right-index-based-on-value-in-Dropdown/m-p/658962#M227580</link>
      <description>&lt;P&gt;Thx that worked fine&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 13:45:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Select-the-right-index-based-on-value-in-Dropdown/m-p/658962#M227580</guid>
      <dc:creator>sandmountain</dc:creator>
      <dc:date>2023-09-28T13:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Select the right index based on value in Dropdown</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Select-the-right-index-based-on-value-in-Dropdown/m-p/659021#M227601</link>
      <description>&lt;P&gt;Please mark the answer as a solution for others to benefit from - thanks&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 00:21:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Select-the-right-index-based-on-value-in-Dropdown/m-p/659021#M227601</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-09-29T00:21:39Z</dc:date>
    </item>
  </channel>
</rss>

