<?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: Join 2 sourcetype on on field if time difference between 2 records is less than 3 seconds in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-2-sourcetype-on-on-field-if-time-difference-between-2/m-p/364683#M107573</link>
    <description>&lt;P&gt;This feels like a problem for transaction with a specified maxspan but I'd have to think about it more to come up with the exact syntax: &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/transaction"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/transaction&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Nov 2017 22:50:06 GMT</pubDate>
    <dc:creator>acharlieh</dc:creator>
    <dc:date>2017-11-09T22:50:06Z</dc:date>
    <item>
      <title>Join 2 sourcetype on on field if time difference between 2 records is less than 3 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-sourcetype-on-on-field-if-time-difference-between-2/m-p/364680#M107570</link>
      <description>&lt;P&gt;So I have 2 different source types which I can join using DEVICE field. But I wan to join records if and only if time difference if less than 3 seconds between them. (If multiple records than take latest one).&lt;/P&gt;

&lt;P&gt;Than I want to show records only if some field in one record contain some value but in other record it doesn't contain that value.&lt;/P&gt;

&lt;P&gt;I have achieved 2nd part using following query but I want with time condition as well.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="index1" sourcetype="source1"  | join  DEVICE [search index=index1 sourcetype=source2 STATE=state1 OR STATE=state2 ] | eval state1=if(like(STATE, "%state1%"), 1, 0) | eval state1Control = if(like(CONTROL, "%state1%"), 1, 0) | eval state2=if(like(STATE, "%state2%"), 1, 0) | eval state2Control = if(like(CONTROL, "%state2%"), 1, 0)  | where state1!=state1Control AND state2!=state2Control |  table  _time, DEVICE, STATE, CONTROL 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Nov 2017 17:48:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-sourcetype-on-on-field-if-time-difference-between-2/m-p/364680#M107570</guid>
      <dc:creator>anujshah</dc:creator>
      <dc:date>2017-11-09T17:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 sourcetype on on field if time difference between 2 records is less than 3 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-sourcetype-on-on-field-if-time-difference-between-2/m-p/364681#M107571</link>
      <description>&lt;P&gt;can you try to do something like &lt;CODE&gt;index="index1" sourcetype="source1"  |bucket _time as timespan span=3s| join  DEVICE timespan [search index=index1 sourcetype=source2 STATE=state1 OR STATE=state2|bucket _time as timespan span=3s ]...&lt;/CODE&gt;&lt;BR /&gt;
to join on a three second span?&lt;BR /&gt;
i think there is probably a better way around that using &lt;CODE&gt;streamstats&lt;/CODE&gt; i'm just trying to think it through&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 21:52:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-sourcetype-on-on-field-if-time-difference-between-2/m-p/364681#M107571</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-11-09T21:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 sourcetype on on field if time difference between 2 records is less than 3 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-sourcetype-on-on-field-if-time-difference-between-2/m-p/364682#M107572</link>
      <description>&lt;P&gt;Thank you so much for answer. I will try this. But time condition here is a bit complex: If the CONTROL in source1 contains state1 than there should be an entry in source2 which contains state1, now that entry can be there before the time of source1 entry or maximum in 3 seconds not after that the entry of source1.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 22:35:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-sourcetype-on-on-field-if-time-difference-between-2/m-p/364682#M107572</guid>
      <dc:creator>anujshah</dc:creator>
      <dc:date>2017-11-09T22:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Join 2 sourcetype on on field if time difference between 2 records is less than 3 seconds</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-2-sourcetype-on-on-field-if-time-difference-between-2/m-p/364683#M107573</link>
      <description>&lt;P&gt;This feels like a problem for transaction with a specified maxspan but I'd have to think about it more to come up with the exact syntax: &lt;A href="http://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/transaction"&gt;http://docs.splunk.com/Documentation/Splunk/7.0.0/SearchReference/transaction&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 22:50:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-2-sourcetype-on-on-field-if-time-difference-between-2/m-p/364683#M107573</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2017-11-09T22:50:06Z</dc:date>
    </item>
  </channel>
</rss>

