<?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: Correlating Data from 2 Indexes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323707#M96640</link>
    <description>&lt;P&gt;I tried a join &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=Networklogs srcip=7.7.7.7 | rename srcip as hostname | join hostname [search index="Scanresults"   hostname="7.7.7.7"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Still not working&lt;/P&gt;</description>
    <pubDate>Wed, 31 May 2017 05:19:16 GMT</pubDate>
    <dc:creator>JRamirezEnosys</dc:creator>
    <dc:date>2017-05-31T05:19:16Z</dc:date>
    <item>
      <title>Correlating Data from 2 Indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323706#M96639</link>
      <description>&lt;P&gt;Hi everyone, I've been trying to add results from 2 different indexes using search after the pipe but it doesn't seem to work.&lt;/P&gt;

&lt;P&gt;My task is to call into 2 different indexes: &lt;/P&gt;

&lt;P&gt;One is called Networklogs and the other is called ScanResults&lt;/P&gt;

&lt;P&gt;There is a field on both indexes with the same information (an ip address) that I want to use as the primary key to correlate them.&lt;/P&gt;

&lt;P&gt;On Networklogs is called srcip and on ScanResults is called hostname&lt;/P&gt;

&lt;P&gt;From the Network logs I want the srcip and the field called app&lt;BR /&gt;
From the ScanResults I want the hostname and a field called fqdn&lt;/P&gt;

&lt;P&gt;I try the following query to mix and match both&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=Networklogs srcip=7.7.7.7  | search index=ScanResults hostname=7.7.7.7 | stats count by srcip app fqdn
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any advice on how to achieve this result?&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 04:32:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323706#M96639</guid>
      <dc:creator>JRamirezEnosys</dc:creator>
      <dc:date>2017-05-31T04:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Correlating Data from 2 Indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323707#M96640</link>
      <description>&lt;P&gt;I tried a join &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=Networklogs srcip=7.7.7.7 | rename srcip as hostname | join hostname [search index="Scanresults"   hostname="7.7.7.7"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Still not working&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 05:19:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323707#M96640</guid>
      <dc:creator>JRamirezEnosys</dc:creator>
      <dc:date>2017-05-31T05:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Correlating Data from 2 Indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323708#M96641</link>
      <description>&lt;P&gt;@JRamirezEnosys, create a Field Alias for one of the fields for example call hostname in index Scanresult as srcip. You can do this from &lt;CODE&gt;Settings &amp;gt; Fields &amp;gt; Field aliases&lt;/CODE&gt;. However, you would need to create Field alias based on either source, sourcetype or host (so identify sourcetype for index="Scanresults" first). Refer to Splunk documentation on how to create Field Alias (&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Addaliasestofields"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Addaliasestofields&lt;/A&gt;).&lt;/P&gt;

&lt;P&gt;Once you have created Field Alias you can try the following search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="Networklogs" OR index="Scanresults" AND srcip="7.7.7.7"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: If possible add sourcetype for both the indexes as well. Narrow dataset in the base search through metadata fields will lead to better search performance.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 07:53:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323708#M96641</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-05-31T07:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Correlating Data from 2 Indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323709#M96642</link>
      <description>&lt;P&gt;can you try something like this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=Networklogs srcip=7.7.7.7) OR (index=ScanResults hostname=7.7.7.7)|eval ipAddress=if(index="Networklogs",srcip,hostname) | stats count values(app) as app values(fqdn) as fqdn by ipAddress
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 11:32:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323709#M96642</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-05-31T11:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Correlating Data from 2 Indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323710#M96643</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=Networklogs OR index=ScanResults | eval joiner=coalesce(srcip, hostname) | stats values(app) AS app values(fqdn) AS fqdn BY joiner
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 15:54:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323710#M96643</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-31T15:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Correlating Data from 2 Indexes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323711#M96644</link>
      <description>&lt;P&gt;Tried this, but haven't been able to fetch the data from second index, &lt;CODE&gt;fqdn&lt;/CODE&gt; in this case. It just shows blank field in the name. Can you refine/recheck the query and suggest a fix?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 10:25:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Correlating-Data-from-2-Indexes/m-p/323711#M96644</guid>
      <dc:creator>harishbenne2</dc:creator>
      <dc:date>2018-08-31T10:25:04Z</dc:date>
    </item>
  </channel>
</rss>

