<?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 Comparing two data sets from the same timeframe and index? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-data-sets-from-the-same-timeframe-and-index/m-p/15804#M2000</link>
    <description>&lt;P&gt;I am trying to compare the results of two searches that share a common timeframe and index, with a negation. The common resulting field may occur multiple times in both searches. As an example:&lt;/P&gt;

&lt;P&gt;Search 1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="stuff" status="LoginSuccessful"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and Search 2 is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="stuff" status="LoginFailed"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If username is in an event in search 2 but &lt;STRONG&gt;NOT&lt;/STRONG&gt; in an event in search 1, I want to see it. (So, show me all of the users that had a failed login and never had a successful login.) &lt;/P&gt;

&lt;P&gt;The only way I have found to do this is to output one set of results to a csv and use lookup to search one. Even if this were two separate indices, I'm not clear on how you would negate the results of an entire join.&lt;/P&gt;

&lt;P&gt;I figure there has to be a simpler way to do this...&lt;/P&gt;</description>
    <pubDate>Sat, 19 Jun 2010 06:21:11 GMT</pubDate>
    <dc:creator>Tisiphone_1</dc:creator>
    <dc:date>2010-06-19T06:21:11Z</dc:date>
    <item>
      <title>Comparing two data sets from the same timeframe and index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-data-sets-from-the-same-timeframe-and-index/m-p/15804#M2000</link>
      <description>&lt;P&gt;I am trying to compare the results of two searches that share a common timeframe and index, with a negation. The common resulting field may occur multiple times in both searches. As an example:&lt;/P&gt;

&lt;P&gt;Search 1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="stuff" status="LoginSuccessful"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and Search 2 is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="stuff" status="LoginFailed"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If username is in an event in search 2 but &lt;STRONG&gt;NOT&lt;/STRONG&gt; in an event in search 1, I want to see it. (So, show me all of the users that had a failed login and never had a successful login.) &lt;/P&gt;

&lt;P&gt;The only way I have found to do this is to output one set of results to a csv and use lookup to search one. Even if this were two separate indices, I'm not clear on how you would negate the results of an entire join.&lt;/P&gt;

&lt;P&gt;I figure there has to be a simpler way to do this...&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2010 06:21:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-data-sets-from-the-same-timeframe-and-index/m-p/15804#M2000</guid>
      <dc:creator>Tisiphone_1</dc:creator>
      <dc:date>2010-06-19T06:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two data sets from the same timeframe and index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-data-sets-from-the-same-timeframe-and-index/m-p/15805#M2001</link>
      <description>&lt;P&gt;There are several easier ways to do this. An efficient way is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=stuff status=loginsuccessful OR status=loginfailed | stats count(eval(status=="LoginSuccessful")) as c_success, count((eval(status=="LoginFailed"))) as c_failure by user | where c_failure &amp;gt; 0 AND c_success == 0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Similar (but somewhat less amenable to map-reduce treatment than the previous, if you have multiple indexer nodes) is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=stuff status=loginsuccessful OR status=loginfailed | transaction user | where status=="LoginFailed" AND NOT status=="LoginSuccessful"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the obvious way (which is just a concise version of what you did) is to use a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=stuff status=loginfailed NOT [ search index=stuff status=loginsuccessful | dedup user | fields user ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this is relatively inefficient and is subject to limits on subsearch and format that must be increased in the system if you have a lot of users.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2010 08:55:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-data-sets-from-the-same-timeframe-and-index/m-p/15805#M2001</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-06-19T08:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing two data sets from the same timeframe and index?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Comparing-two-data-sets-from-the-same-timeframe-and-index/m-p/15806#M2002</link>
      <description>&lt;P&gt;Thanks! I had my syntax mixed up on the last. Now it works!&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2010 08:58:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Comparing-two-data-sets-from-the-same-timeframe-and-index/m-p/15806#M2002</guid>
      <dc:creator>Tisiphone_1</dc:creator>
      <dc:date>2010-06-19T08:58:59Z</dc:date>
    </item>
  </channel>
</rss>

