<?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: How do you correlate data from multiple indexes? in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440847#M5936</link>
    <description>&lt;P&gt;@harishbenne2,&lt;/P&gt;

&lt;P&gt;upto my understanding. your trying to join the &lt;CODE&gt;httpdmz.sessionid=appdmz.Session&lt;/CODE&gt;, sessionid of index=httpdmz with Session of index=appdmz. you want to fetch matching values of sessionid=Session  and process further right.. &lt;/P&gt;

&lt;P&gt;Then you need to go for join condition. I have provided the sample example below. You need to replace your index and required field in below query. For getting matching data. Field name should be same in both the index. So only i have rename sessionid as Session &lt;CODE&gt;| rename sessionid as Session&lt;/CODE&gt; .&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=httpdmz (replace with ur tetsing index)
| rename sessionid as Session
| table Session url ipadd 
| join type=inner Session  [ index=appdmz (replace with ur tetsing index)
| table Session user
] 
| table ipadd Session user url
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example to show how join works with sample data ..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval mytrimexaxis =mvappend("1531981800","1531982400","1531982700","1531983000","1531983600") 
| eval mysite =mvappend("alpha","beta","game","show","check") 
| mvexpand mytrimexaxis  
| rename mytrimexaxis as datajoin
| table datajoin mysite
| join type=inner datajoin  [ | makeresults 
| eval datajoin="1531981800"
] 
 | table datajoin mysite
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks..&lt;/P&gt;</description>
    <pubDate>Sat, 01 Sep 2018 07:17:43 GMT</pubDate>
    <dc:creator>Shan</dc:creator>
    <dc:date>2018-09-01T07:17:43Z</dc:date>
    <item>
      <title>How do you correlate data from multiple indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440841#M5930</link>
      <description>&lt;P&gt;I have 2 indexes that have 2 different parts of same data. One index contains http connection details and another contains it's corresponding application data.&lt;/P&gt;

&lt;P&gt;Index=HTTPDMZ&lt;BR /&gt;
field1=ipadd - Source IP Address&lt;BR /&gt;
field2=sessionid - Session ID&lt;BR /&gt;
field3=url - URL Link&lt;/P&gt;

&lt;P&gt;index=APPDMZ&lt;BR /&gt;
field1 = Session - Session ID&lt;BR /&gt;
field2 = url - URL Link&lt;BR /&gt;
field3 = user - Username&lt;/P&gt;

&lt;P&gt;I need to export a comprehensive report with following fields:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;ipadd&lt;/LI&gt;
&lt;LI&gt;sessionid&lt;/LI&gt;
&lt;LI&gt;user&lt;/LI&gt;
&lt;LI&gt;url&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;I have tried the &lt;CODE&gt;coalesce&lt;/CODE&gt; command and also merging 2 field names &lt;CODE&gt;(eval correlation_field=case(isnotnull(sessionid), sessionid, isnotnull(Session), Session, 1=1, "unknown") | stats values(url) as url values(user) as user by ipadd correlation_field&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Both haven't worked out for this case. Any other solution will be most helpful.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 11:40:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440841#M5930</guid>
      <dc:creator>harishbenne2</dc:creator>
      <dc:date>2018-08-31T11:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate data from multiple indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440842#M5931</link>
      <description>&lt;P&gt;Can you post your full search ? &lt;/P&gt;

&lt;P&gt;On the face of it, I would try a search like;&lt;/P&gt;

&lt;P&gt;index=httpdmz OR index=appdmz | stats values(ipadd) AS ipadd values(user) AS user values(url) AS url BY sessionid&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 12:09:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440842#M5931</guid>
      <dc:creator>deking_splunk</dc:creator>
      <dc:date>2018-08-31T12:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate data from multiple indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440843#M5932</link>
      <description>&lt;P&gt;This is the entire search is as below:&lt;BR /&gt;
&lt;CODE&gt;index=httpdmz OR index=appdmz | (eval correlation_field=case(isnotnull(sessionid), sessionid, isnotnull(Session), Session, 1=1, "unknown") | stats values(url) as url values(user) as user values(ipadd) as ipadd by correlation_field&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;But it just doesn't work!&lt;/P&gt;

&lt;P&gt;If you've worked in SQL,this might ring a bell: we always bind the columns through a where condition like &lt;CODE&gt;where httpdmz.sessionid=appdmz.Session&lt;/CODE&gt; through which the engine understands that it needs to map the &lt;CODE&gt;sessionid&lt;/CODE&gt; column in &lt;CODE&gt;httpdmz&lt;/CODE&gt; table with &lt;CODE&gt;Session&lt;/CODE&gt; column in &lt;CODE&gt;appdmz&lt;/CODE&gt; table to fetch its relevant data. I am not sure how Splunk or any other system can fetch the relative details without understanding the relation between fields.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 13:00:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440843#M5932</guid>
      <dc:creator>harishbenne2</dc:creator>
      <dc:date>2018-08-31T13:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate data from multiple indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440844#M5933</link>
      <description>&lt;P&gt;Also in addition to that &lt;CODE&gt;index=httpdmz OR index=appdmz | stats values(ipadd) AS ipadd values(user) AS user values(url) AS url BY sessionid&lt;/CODE&gt; doesn't work. Because it doesn't understand the correlation between user and ipadd, which is the sessionid/Session.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 13:02:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440844#M5933</guid>
      <dc:creator>harishbenne2</dc:creator>
      <dc:date>2018-08-31T13:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate data from multiple indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440845#M5934</link>
      <description>&lt;P&gt;Ahh OK so the session and sessionid are different field names in the respective indexes? &lt;/P&gt;

&lt;P&gt;If thats the case you could use coalesce ; &lt;/P&gt;

&lt;P&gt;search  | eval correlation_field=coalesce(session,sessionid)  | stats values(ipadd) AS ipadd values(user) AS user values(url) AS url BY correlation_field&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:06:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440845#M5934</guid>
      <dc:creator>deking_splunk</dc:creator>
      <dc:date>2020-09-29T21:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate data from multiple indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440846#M5935</link>
      <description>&lt;P&gt;Tried it in two ways, still only the &lt;CODE&gt;user&lt;/CODE&gt; data is being fetched. &lt;CODE&gt;ipadd&lt;/CODE&gt; field is still blank.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 14:50:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440846#M5935</guid>
      <dc:creator>harishbenne2</dc:creator>
      <dc:date>2018-08-31T14:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate data from multiple indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440847#M5936</link>
      <description>&lt;P&gt;@harishbenne2,&lt;/P&gt;

&lt;P&gt;upto my understanding. your trying to join the &lt;CODE&gt;httpdmz.sessionid=appdmz.Session&lt;/CODE&gt;, sessionid of index=httpdmz with Session of index=appdmz. you want to fetch matching values of sessionid=Session  and process further right.. &lt;/P&gt;

&lt;P&gt;Then you need to go for join condition. I have provided the sample example below. You need to replace your index and required field in below query. For getting matching data. Field name should be same in both the index. So only i have rename sessionid as Session &lt;CODE&gt;| rename sessionid as Session&lt;/CODE&gt; .&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=httpdmz (replace with ur tetsing index)
| rename sessionid as Session
| table Session url ipadd 
| join type=inner Session  [ index=appdmz (replace with ur tetsing index)
| table Session user
] 
| table ipadd Session user url
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example to show how join works with sample data ..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval mytrimexaxis =mvappend("1531981800","1531982400","1531982700","1531983000","1531983600") 
| eval mysite =mvappend("alpha","beta","game","show","check") 
| mvexpand mytrimexaxis  
| rename mytrimexaxis as datajoin
| table datajoin mysite
| join type=inner datajoin  [ | makeresults 
| eval datajoin="1531981800"
] 
 | table datajoin mysite
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks..&lt;/P&gt;</description>
      <pubDate>Sat, 01 Sep 2018 07:17:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440847#M5936</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2018-09-01T07:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate data from multiple indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440848#M5937</link>
      <description>&lt;P&gt;Hi, I am trying this command but not working for me. My requirement is I have two indexes, both has ticket numbers(same name) and I have to append SLA field from one of the indexes. &lt;BR /&gt;
Index=a - has ticket number, SLA &lt;BR /&gt;
index =b  - has ticket number, and my other fierlds &lt;/P&gt;

&lt;P&gt;I want to join both of them and get the value of SLA for matching incident numbers. &lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 11:32:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440848#M5937</guid>
      <dc:creator>abhijitsaoji</dc:creator>
      <dc:date>2019-05-23T11:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate data from multiple indexes?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440849#M5938</link>
      <description>&lt;P&gt;join has worked, below is the query. &lt;BR /&gt;
index="A" &lt;BR /&gt;
|join type=inner inc_number [search index= "B"] &lt;BR /&gt;
|dedup inc_number&lt;BR /&gt;
|table inc_number,SLA&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:39:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-do-you-correlate-data-from-multiple-indexes/m-p/440849#M5938</guid>
      <dc:creator>abhijitsaoji</dc:creator>
      <dc:date>2020-09-30T00:39:55Z</dc:date>
    </item>
  </channel>
</rss>

