<?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 get specified events from 2 indices. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-specified-events-from-2-indices/m-p/500604#M140145</link>
    <description>&lt;P&gt;&lt;STRONG&gt;SITUATION:&lt;/STRONG&gt;&lt;BR /&gt;- I use indices "A" and "B" to come to answer the same question but for different environments.&lt;BR /&gt;- Each index has unique fields names but said fields represent the same data in each index.&lt;BR /&gt;- I want a table to answer the same question in one table using both indices.&lt;BR /&gt;- I'm starting with SPL similar to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;(index=A AND  indexA_unqiue_field=x) OR (index=B AND sourcetype=v indexB_unique_field=y)
| rename indexA_unqiue_field AS field
| rename indexB_unique_field AS field
| table _time, field, index
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;PROBLEM:&lt;/STRONG&gt; &lt;BR /&gt;- With the above SPL I am failing to answer the same question using the 2 indices. It appears to work fine for index B but "field" does not populate for Index A.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;QUESTION:&lt;/STRONG&gt;&lt;BR /&gt;- How do I get all fields to populate?&lt;BR /&gt;- Or how may I achieve the goal?&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jun 2020 23:49:29 GMT</pubDate>
    <dc:creator>jsven7</dc:creator>
    <dc:date>2020-06-05T23:49:29Z</dc:date>
    <item>
      <title>How to get specified events from 2 indices.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-specified-events-from-2-indices/m-p/500604#M140145</link>
      <description>&lt;P&gt;&lt;STRONG&gt;SITUATION:&lt;/STRONG&gt;&lt;BR /&gt;- I use indices "A" and "B" to come to answer the same question but for different environments.&lt;BR /&gt;- Each index has unique fields names but said fields represent the same data in each index.&lt;BR /&gt;- I want a table to answer the same question in one table using both indices.&lt;BR /&gt;- I'm starting with SPL similar to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;(index=A AND  indexA_unqiue_field=x) OR (index=B AND sourcetype=v indexB_unique_field=y)
| rename indexA_unqiue_field AS field
| rename indexB_unique_field AS field
| table _time, field, index
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;PROBLEM:&lt;/STRONG&gt; &lt;BR /&gt;- With the above SPL I am failing to answer the same question using the 2 indices. It appears to work fine for index B but "field" does not populate for Index A.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;QUESTION:&lt;/STRONG&gt;&lt;BR /&gt;- How do I get all fields to populate?&lt;BR /&gt;- Or how may I achieve the goal?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2020 23:49:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-specified-events-from-2-indices/m-p/500604#M140145</guid>
      <dc:creator>jsven7</dc:creator>
      <dc:date>2020-06-05T23:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to get specified events from 2 indices.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-specified-events-from-2-indices/m-p/500605#M140146</link>
      <description>&lt;P&gt;The COALESCE command might be your friend here: &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.3/SearchReference/ConditionalFunctions#coalesce.28X.2C....29"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.3/SearchReference/ConditionalFunctions#coalesce.28X.2C....29&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2020 14:26:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-specified-events-from-2-indices/m-p/500605#M140146</guid>
      <dc:creator>iainsmart</dc:creator>
      <dc:date>2020-05-18T14:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get specified events from 2 indices.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-specified-events-from-2-indices/m-p/500606#M140147</link>
      <description>&lt;P&gt;I think the two renames to the same field name are causing the problem.  Try &lt;CODE&gt;coalesce&lt;/CODE&gt;, instead.  It will set 'field' either indexA_unique_field or indexB_unique_field, whichever is present in the event.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=A AND  indexA_unqiue_field=x) OR (index=B AND sourcetype=v indexB_unique_field=y)
| eval field = coalesce(indexA_unqiue_field, indexB_unique_field)
| table _time, field, index
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 05:30:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-specified-events-from-2-indices/m-p/500606#M140147</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-09-30T05:30:06Z</dc:date>
    </item>
  </channel>
</rss>

