<?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 Find all events not having a corresponding event matched by one field's value (WHERE NOT EXISTS) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-all-events-not-having-a-corresponding-event-matched-by-one/m-p/174343#M50020</link>
    <description>&lt;P&gt;I am dealing with two event types: &lt;CODE&gt;request_start&lt;/CODE&gt; and &lt;CODE&gt;request_end&lt;/CODE&gt;.  Both have a &lt;CODE&gt;request_id&lt;/CODE&gt; field. Is there a way that I can find all &lt;CODE&gt;request_start&lt;/CODE&gt; events that exist where there is no &lt;CODE&gt;request_end&lt;/CODE&gt; event with the same &lt;CODE&gt;request_id&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;I've found on here that it's easy to filter out events having the same value in two different fields, but this is different because it requires a "WHERE NOT EXISTS" sort of predicate to reference another event rather than comparing values in the same event. &lt;/P&gt;</description>
    <pubDate>Wed, 21 May 2014 20:31:50 GMT</pubDate>
    <dc:creator>lbowen</dc:creator>
    <dc:date>2014-05-21T20:31:50Z</dc:date>
    <item>
      <title>Find all events not having a corresponding event matched by one field's value (WHERE NOT EXISTS)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-all-events-not-having-a-corresponding-event-matched-by-one/m-p/174343#M50020</link>
      <description>&lt;P&gt;I am dealing with two event types: &lt;CODE&gt;request_start&lt;/CODE&gt; and &lt;CODE&gt;request_end&lt;/CODE&gt;.  Both have a &lt;CODE&gt;request_id&lt;/CODE&gt; field. Is there a way that I can find all &lt;CODE&gt;request_start&lt;/CODE&gt; events that exist where there is no &lt;CODE&gt;request_end&lt;/CODE&gt; event with the same &lt;CODE&gt;request_id&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;I've found on here that it's easy to filter out events having the same value in two different fields, but this is different because it requires a "WHERE NOT EXISTS" sort of predicate to reference another event rather than comparing values in the same event. &lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2014 20:31:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-all-events-not-having-a-corresponding-event-matched-by-one/m-p/174343#M50020</guid>
      <dc:creator>lbowen</dc:creator>
      <dc:date>2014-05-21T20:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Find all events not having a corresponding event matched by one field's value (WHERE NOT EXISTS)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-all-events-not-having-a-corresponding-event-matched-by-one/m-p/174344#M50021</link>
      <description>&lt;P&gt;Sure.  The following methods assume that request_id is unique and that each request will only have one request_start and request_end event each.  One way to find what you need would be to use &lt;STRONG&gt;transaction&lt;/STRONG&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=request_start OR eventtype=request_end 
| transaction request_id startswith="eventtype=request_start" endswith="eventtype=request_end" keepevicted=t 
| search closed_txn=0 eventtype=request_start 
| stats count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Another way of doing this would be to use &lt;STRONG&gt;stats&lt;/STRONG&gt; and a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventtype=request_start [search eventtype=request_start OR eventtype=request_end 
| stats count by request_id | where count=1 | fields request_id]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Try these out and see if they get what you need.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:41:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-all-events-not-having-a-corresponding-event-matched-by-one/m-p/174344#M50021</guid>
      <dc:creator>wpreston</dc:creator>
      <dc:date>2020-09-28T16:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Find all events not having a corresponding event matched by one field's value (WHERE NOT EXISTS)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-all-events-not-having-a-corresponding-event-matched-by-one/m-p/174345#M50022</link>
      <description>&lt;P&gt;You're awesome.&lt;/P&gt;</description>
      <pubDate>Wed, 21 May 2014 21:19:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-all-events-not-having-a-corresponding-event-matched-by-one/m-p/174345#M50022</guid>
      <dc:creator>lbowen</dc:creator>
      <dc:date>2014-05-21T21:19:48Z</dc:date>
    </item>
  </channel>
</rss>

