<?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 events from two different indexes by date? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426020#M172650</link>
    <description>&lt;P&gt;Can you try something like this ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="ABC" OR index="XYZ" 
| stats latest(eval(case(index="ABC" AND action="Login",_time))) as login_time latest(eval(case(index="ABC" AND action="Logout",_time))) as logout_time latest(eval(case(index="XYZ",_time))) as compare_time latest(CRUD) as CRUD latest(sessionkey) as sessionkey by name 
| where login_time&amp;lt;compare_time AND logout_time&amp;gt;compare_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
    <pubDate>Fri, 08 Mar 2019 00:41:48 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2019-03-08T00:41:48Z</dc:date>
    <item>
      <title>How do you correlate events from two different indexes by date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426017#M172647</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;

&lt;P&gt;I have 2 indexes containing information as below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index ABC

_time                   sessionkey                  name     action
06/03/2019 01:15:20   XfRtG5R3FR$Er                John       Login
06/03/2019 01:18:25   XfRtG5R3FR$Er                John       Logout
06/03/2019 03:28:10   FFT$WFTFETR%                 John       Login
06/03/2019 03:31:56   FFT$WFTFETR%                 John       Logout
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;index XYZ&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  _time                    name     CRUD
06/03/2019 01:16:22        John     Update
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, unfortunately, I don't have a session key in both indexes to tie in these two events. &lt;/P&gt;

&lt;P&gt;How can I correlate these 2 logs by Name AND date range? i.e.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TimeSessionStarted  TimeSessionFinished  sessionkey   name  CRUD
06/03/2019 01:15:20 06/03/2019 01:18:25 XfRtG5R3FR$Er John Update
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Cheers,&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 23:45:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426017#M172647</guid>
      <dc:creator>ADRIANODL</dc:creator>
      <dc:date>2019-03-07T23:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate events from two different indexes by date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426018#M172648</link>
      <description>&lt;P&gt;Well as long as the times are exactly the same, this should work: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index ABC OR index XYZ
|stats latest(CRUD) as CRUD latest(action) as action latest(sessionkey) as sessionkey by _time  name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Mar 2019 23:53:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426018#M172648</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-03-07T23:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate events from two different indexes by date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426019#M172649</link>
      <description>&lt;P&gt;Unfortunately the times are not the same. The time on index XYZ falls under a session of index ABC though.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 23:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426019#M172649</guid>
      <dc:creator>ADRIANODL</dc:creator>
      <dc:date>2019-03-07T23:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate events from two different indexes by date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426020#M172650</link>
      <description>&lt;P&gt;Can you try something like this ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="ABC" OR index="XYZ" 
| stats latest(eval(case(index="ABC" AND action="Login",_time))) as login_time latest(eval(case(index="ABC" AND action="Logout",_time))) as logout_time latest(eval(case(index="XYZ",_time))) as compare_time latest(CRUD) as CRUD latest(sessionkey) as sessionkey by name 
| where login_time&amp;lt;compare_time AND logout_time&amp;gt;compare_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 00:41:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426020#M172650</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-03-08T00:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do you correlate events from two different indexes by date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426021#M172651</link>
      <description>&lt;P&gt;Hi mayurr98,&lt;BR /&gt;
Apologies but I didn't explain the whole thing: the login/logout words don't always appear, so I should rather use the session key as what defines a session.&lt;BR /&gt;
Does that make sense?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Mar 2019 02:19:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-correlate-events-from-two-different-indexes-by-date/m-p/426021#M172651</guid>
      <dc:creator>ADRIANODL</dc:creator>
      <dc:date>2019-03-08T02:19:07Z</dc:date>
    </item>
  </channel>
</rss>

