<?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: Search query to combine data from 2 different index not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/696090#M236600</link>
    <description>&lt;P&gt;As per&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;'s comment, yes it is case sensitive. Use eval upper or lower to convert them all to the same case&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2024 04:21:18 GMT</pubDate>
    <dc:creator>KendallW</dc:creator>
    <dc:date>2024-08-13T04:21:18Z</dc:date>
    <item>
      <title>Search query to combine data from 2 different index not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695944#M236575</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;i need to consolidate / correlate data from 2 different indexes as explained below. I have gone thru multiple posts on this forum from experts relevant to this but somehow for my use case, the same query ain't working. I have below situation:&lt;BR /&gt;In Index=&lt;STRONG&gt;windows&lt;/STRONG&gt; , the field "&lt;STRONG&gt;host&lt;/STRONG&gt;" contains all the different hosts sending logs to Splunk. For example: Host01, Host02 etc.&lt;BR /&gt;In another index=&lt;STRONG&gt;cmdb&lt;/STRONG&gt;, the field "&lt;STRONG&gt;dv_name&lt;/STRONG&gt;" contain the same hostnames sending logs.&amp;nbsp; &amp;nbsp;Also, there are other fields like dv_status and dv_os in this index which i need to be part of final output&lt;/P&gt;&lt;P&gt;So as explained above,&amp;nbsp; the common link is the host field, its &lt;STRONG&gt;name&lt;/STRONG&gt; is different across the 2 index, but the &lt;STRONG&gt;values&lt;/STRONG&gt; are same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When i run the following 2 queries to get my expected output, it only pulls data from windows index. It completely avoids the other cmdb index, irrespective of the fact the cmdb index has data / events from same hosts in the time range whatever i select.&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;(index=windows) OR (index=cmdb sourcetype="snow:cmdb_ci_server" dv_name=*)
| eval asset_name=coalesce(dv_name, host)
| stats dc(index) as idx_count, values(index) values(dv_os), values(dv_install_status) by asset_name&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output it it showing:&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="20%"&gt;asset_name&lt;/TD&gt;&lt;TD width="20%"&gt;idx_count&lt;/TD&gt;&lt;TD width="20%"&gt;index&lt;/TD&gt;&lt;TD width="20%"&gt;dv_os&lt;/TD&gt;&lt;TD width="20%"&gt;dv_status&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;Host01&lt;/TD&gt;&lt;TD width="20%"&gt;1&lt;/TD&gt;&lt;TD width="20%"&gt;windows&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;Host02&lt;/TD&gt;&lt;TD width="20%"&gt;1&lt;/TD&gt;&lt;TD width="20%"&gt;windows&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="20%"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected output&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="20%"&gt;asset_name&lt;/TD&gt;&lt;TD width="20%"&gt;idx_count&lt;/TD&gt;&lt;TD width="20%"&gt;index&lt;/TD&gt;&lt;TD width="20%"&gt;dv_os&lt;/TD&gt;&lt;TD width="20%"&gt;dv_install_status&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;Host01&lt;/TD&gt;&lt;TD width="20%"&gt;2&lt;/TD&gt;&lt;TD width="20%"&gt;windows, cmdb&lt;/TD&gt;&lt;TD width="20%"&gt;Windows Server&lt;/TD&gt;&lt;TD width="20%"&gt;Production&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="20%"&gt;Host02&lt;/TD&gt;&lt;TD width="20%"&gt;2&lt;/TD&gt;&lt;TD width="20%"&gt;windows, cmdb&lt;/TD&gt;&lt;TD width="20%"&gt;Windows Server&lt;/TD&gt;&lt;TD width="20%"&gt;Test&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 05:51:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695944#M236575</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2024-08-12T05:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Search query to combine data from 2 different index not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695945#M236576</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229059"&gt;@neerajs_81&lt;/a&gt;&amp;nbsp;try just renaming the dv_name field instead of creating a new field with coalesce, e.g.:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=cmdb sourcetye=server) OR (index=windows)
| rename dv_name as host
| stats dc(index) as idx_count, values(index) values(dv_os), values(dv_install_status) by host&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 05:51:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695945#M236576</guid>
      <dc:creator>KendallW</dc:creator>
      <dc:date>2024-08-12T05:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: Search query to combine data from 2 different index not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695946#M236577</link>
      <description>&lt;P&gt;That didn't work. Query does not show any results if we rename the dv_name to host. That is because host is a default field&amp;nbsp; and for index=cmdb, the &lt;STRONG&gt;host&lt;/STRONG&gt; field originally contains the name of the Log source (ServiceNow) sending over the asset information to splunk. Renaming it overwrites the default field.&lt;BR /&gt;thanks for replying though.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 05:58:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695946#M236577</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2024-08-12T05:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: Search query to combine data from 2 different index not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695947#M236578</link>
      <description>&lt;P&gt;It shouldn't matter what is contained in the host field in the 'cmdb' index as we are overwriting it. There is no problem with overwriting default fields in a search.&lt;BR /&gt;Regardless, I still can't see why your original query didn't work. - There may be some whitespace or other strange characters in some of the field values from one of the indexes causing them to not match with the other index. Are you able to check this?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 06:15:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695947#M236578</guid>
      <dc:creator>KendallW</dc:creator>
      <dc:date>2024-08-12T06:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Search query to combine data from 2 different index not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695953#M236579</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/121137"&gt;@KendallW&lt;/a&gt;&amp;nbsp; Does the coalesce or rename command treat the hostnames differently if they are different in cases? One is lower case in one index and other index has the same hostname in Upper case. Is the merge case sensitive ?&amp;nbsp;&amp;nbsp;For example,&amp;nbsp; &lt;STRONG&gt;HOST01&lt;/STRONG&gt; which is one of the values in &lt;STRONG&gt;host&lt;/STRONG&gt; field of index=windows, is actually&amp;nbsp; &lt;STRONG&gt;host01&lt;/STRONG&gt; in index=cmdb ( under the &lt;STRONG&gt;dv_name&lt;/STRONG&gt;) field.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;That explains why the consolidation via coalesce or rename ain't working.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 07:14:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695953#M236579</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2024-08-12T07:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Search query to combine data from 2 different index not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695956#M236581</link>
      <description>&lt;P&gt;Case does matter - as far as Splunk is concerned they are two different hosts - you could try converting to lower case&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(index=windows) OR (index=cmdb sourcetype="snow:cmdb_ci_server" dv_name=*)
| eval asset_name=lower(coalesce(dv_name, host))
| stats dc(index) as idx_count, values(index) values(dv_os), values(dv_install_status) by asset_name&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 12 Aug 2024 07:12:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/695956#M236581</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-08-12T07:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Search query to combine data from 2 different index not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/696090#M236600</link>
      <description>&lt;P&gt;As per&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;'s comment, yes it is case sensitive. Use eval upper or lower to convert them all to the same case&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 04:21:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-query-to-combine-data-from-2-different-index-not-working/m-p/696090#M236600</guid>
      <dc:creator>KendallW</dc:creator>
      <dc:date>2024-08-13T04:21:18Z</dc:date>
    </item>
  </channel>
</rss>

