<?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: Define &amp;amp; use variable in same search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509061#M142235</link>
    <description>Thanks for the explanation.&lt;BR /&gt;Perhaps you could put the search into a dashboard and have selectors at the top to choose the index. Those selectors would become tokens in the search.</description>
    <pubDate>Tue, 14 Jul 2020 12:39:44 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-07-14T12:39:44Z</dc:date>
    <item>
      <title>Define &amp; use variable in same search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/508824#M142155</link>
      <description>&lt;P&gt;Hello, fellow splunkers!&lt;/P&gt;&lt;P&gt;I am trying to find a search string where I could define a variable &amp;amp; then use it in the same search.&lt;BR /&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var1=some_value; var2=some_value;  | index="$var1-app01-$var2" OR index="$var1-app02-$var2" OR index="$var1-app03-$var2" "error" OR "severe"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our current Splunk setup has too many indexes per customer/environment &amp;amp; this little feature would help a lot with unifying the searches.&lt;BR /&gt;&lt;BR /&gt;I tried to browse the web/this forum and unfortunately did not find this or a similar issue.&lt;BR /&gt;&lt;BR /&gt;Any help is appreciated, thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 14:17:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/508824#M142155</guid>
      <dc:creator>Filomenka</dc:creator>
      <dc:date>2020-07-13T14:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Define &amp; use variable in same search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/508825#M142156</link>
      <description>&lt;P&gt;Splunk doesn't have the concept of variables.&amp;nbsp; Sometimes a field can be used as a variable, however, or you can use a macro.&amp;nbsp; Please explain more about "&lt;SPAN&gt;unifying the searches" so we can suggest the best method for you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 14:32:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/508825#M142156</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-13T14:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Define &amp; use variable in same search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509020#M142212</link>
      <description>&lt;P&gt;Well, that is unfortunate, since the variable part would solve this issue.&lt;BR /&gt;&lt;BR /&gt;We have x-customers, y-applications per customer &amp;amp; 3-6 environments per customer.&lt;BR /&gt;&lt;BR /&gt;Indexes share the same naming convention:&lt;BR /&gt;index=&amp;lt;$customer&amp;gt;-&amp;lt;$app01&amp;gt;-&amp;lt;$environment&amp;gt;&lt;/P&gt;&lt;P&gt;We have 10+ applications, 3-6 environments per customer &amp;amp; every search is a hard-coded index with customer-app-evironment.&lt;BR /&gt;&lt;BR /&gt;We have a dashboard per customer created with specific searches but for ad-hoc debugging this is my personal go-to (splunk search) for filtering interesting data.&lt;BR /&gt;&lt;BR /&gt;The reason for this post was to create an "ultimate one-line" search, where only 2 parts of the data would change (input for the search =&amp;gt; variable).&lt;BR /&gt;&lt;BR /&gt;I am not sure this is the right approach, but it definitely looks like the easiest.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 09:17:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509020#M142212</guid>
      <dc:creator>Filomenka</dc:creator>
      <dc:date>2020-07-14T09:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Define &amp; use variable in same search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509061#M142235</link>
      <description>Thanks for the explanation.&lt;BR /&gt;Perhaps you could put the search into a dashboard and have selectors at the top to choose the index. Those selectors would become tokens in the search.</description>
      <pubDate>Tue, 14 Jul 2020 12:39:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509061#M142235</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-14T12:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Define &amp; use variable in same search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509169#M142296</link>
      <description>&lt;P&gt;As mentioned I already have dashboards in place with the needed filters:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Filomenka_0-1594791212472.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9695i7477F80C422521C5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Filomenka_0-1594791212472.png" alt="Filomenka_0-1594791212472.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Trying to think this through - can I add a "custom field" (type string) which would be used as an additional filter (in the screenshot)?&lt;BR /&gt;This way I could achieve the same thing you mentioned (&lt;SPAN&gt;dashboard with selectors) + the custom field &amp;amp; it would solve the issue.&lt;BR /&gt;&lt;BR /&gt;BTW Thank you for your time &amp;amp; effort&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;, I really appreciate it.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 05:39:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509169#M142296</guid>
      <dc:creator>Filomenka</dc:creator>
      <dc:date>2020-07-15T05:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Define &amp; use variable in same search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509273#M142314</link>
      <description>Yes, that should work.</description>
      <pubDate>Wed, 15 Jul 2020 12:26:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509273#M142314</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-15T12:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Define &amp; use variable in same search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509307#M142323</link>
      <description>&lt;P&gt;Thank you rich, you are a lifesaver! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Works like a charm...&lt;/P&gt;&lt;P&gt;If anybody else is reading this, this is the solution that worked for me (this can be used as a template):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form theme="dark"&amp;gt;
  &amp;lt;label&amp;gt;debug-dashboard-beta&amp;lt;/label&amp;gt;
  &amp;lt;description&amp;gt;closeml debug&amp;lt;/description&amp;gt;
  &amp;lt;fieldset submitButton="true" autoRun="true"&amp;gt;
    &amp;lt;input type="time" token="time"&amp;gt;
      &amp;lt;label&amp;gt;Time range&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-15m@m&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="Customer"&amp;gt;
      &amp;lt;label&amp;gt;Customer&amp;lt;/label&amp;gt;
      &amp;lt;choice value="*"&amp;gt;ALL&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="abc"&amp;gt;ABC&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="123"&amp;gt;123&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="xyz"&amp;gt;XYZ&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;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="*"&amp;gt;ALL&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="prod"&amp;gt;prod&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="acc"&amp;gt;acc&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="test"&amp;gt;test&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="dev"&amp;gt;dev&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="Label"&amp;gt;
      &amp;lt;label&amp;gt;Label&amp;lt;/label&amp;gt;
      &amp;lt;selectFirstChoice&amp;gt;true&amp;lt;/selectFirstChoice&amp;gt;
      &amp;lt;choice value=""&amp;gt;No label&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="b"&amp;gt;b&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="c"&amp;gt;c&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="custom_search"&amp;gt;
      &amp;lt;label&amp;gt;Custom search&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;"0200 error" OR "0200 severe"&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;event&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index="$Customer$-closeml$Label$-$Environment$" OR index="$Customer$-close-rest-api$Label$-$Environment$" OR index="$Customer$-close-communication-service$Label$-$Environment$" OR index="$Customer$-transfer-service$Label$-$Environment$" OR index="$Customer$-close-document-service$Label$-$Environment$" OR index="$Customer$-closeml-dsf$Label$-$Environment$" OR index="$Customer$-close-document-generator$Label$-$Environment$" OR index="$Customer$-closeml-loan-service$Label$-$Environment$" OR index="$Customer$-calculation-service$Label$-$Environment$" $custom_search$&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$time.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$time.latest$&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="list.drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="list.wrap"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="maxLines"&amp;gt;5&amp;lt;/option&amp;gt;
        &amp;lt;option name="raw.drilldown"&amp;gt;full&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="table.drilldown"&amp;gt;all&amp;lt;/option&amp;gt;
        &amp;lt;option name="table.sortDirection"&amp;gt;asc&amp;lt;/option&amp;gt;
        &amp;lt;option name="table.wrap"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="type"&amp;gt;list&amp;lt;/option&amp;gt;
      &amp;lt;/event&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 13:41:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509307#M142323</guid>
      <dc:creator>Filomenka</dc:creator>
      <dc:date>2020-07-15T13:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Define &amp; use variable in same search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509335#M142334</link>
      <description>&lt;P&gt;If your problem is resolved, then please click a "Accept as Solution" button to help future readers.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 15:13:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-amp-use-variable-in-same-search/m-p/509335#M142334</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-07-15T15:13:14Z</dc:date>
    </item>
  </channel>
</rss>

