<?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 to compare values from two different searches in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269843#M81211</link>
    <description>&lt;P&gt;I guess you should be using appendcols here. Append will create those fields in totally different events/rows and your eval will fail.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2016 22:31:50 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-02-04T22:31:50Z</dc:date>
    <item>
      <title>how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269840#M81208</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I need to run a compare against the count of two different searches - how would I do that?  I'm counting the number of unique sources from two different indexes, and they need to be the same. &lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 21:39:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269840#M81208</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2016-02-04T21:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269841#M81209</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;  index=index1 | dedup source | stats dc(source) AS idx1ct | appendcols [search index=index2 | dedup source | stats dc(source) AS idx2ct ] | eval nodiff=if(match(idxct1,idxct2),"True","False") | table nodiff
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Feb 2016 22:11:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269841#M81209</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-02-04T22:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269842#M81210</link>
      <description>&lt;P&gt;It depends upon what type of searches and what columns are available on those two searches. Could you provide some more information on the output of the those two searches? Based on that it could be appendcols OR join OR may be simple stats can do the job.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 22:17:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269842#M81210</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-04T22:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269843#M81211</link>
      <description>&lt;P&gt;I guess you should be using appendcols here. Append will create those fields in totally different events/rows and your eval will fail.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 22:31:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269843#M81211</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-04T22:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269844#M81212</link>
      <description>&lt;P&gt;A simple stats command should do the trick&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=index1 OR index=index2 | stats dc(source) by index
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Have a read &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/Stats"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.3/SearchReference/Stats&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If theres one command you learn, make it stats!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2016 22:41:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269844#M81212</guid>
      <dc:creator>jplumsdaine22</dc:creator>
      <dc:date>2016-02-04T22:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269845#M81213</link>
      <description>&lt;P&gt;changed to appendcols, thanks.    So a little more explanation now that I'm not on my phone.  The search creates a field called nodiff that is true if there isnt a difference in the count of sources between indexes, or false if there is a difference.  The dedups speed up the stats distinct count functions but are not required.  Remove the final table to see the rest of the fields.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 07:46:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269845#M81213</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-02-05T07:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269846#M81214</link>
      <description>&lt;P&gt;Hi &lt;BR /&gt;
Use this search code and look at the difference in the results&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      index=_internal | stats dc(source) AS C1| appendcols [search index=_audit| stats dc(source) AS C2 ] |table C1 C2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1034i6D8FB7D8EA205A42/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2016 11:24:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269846#M81214</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2016-02-05T11:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269847#M81215</link>
      <description>&lt;P&gt;Thanks!!!!&lt;/P&gt;</description>
      <pubDate>Sun, 10 Apr 2016 01:38:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269847#M81215</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2016-04-10T01:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269848#M81216</link>
      <description>&lt;P&gt;Hi a212830,&lt;/P&gt;

&lt;P&gt;Read &lt;A href="https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html"&gt;https://answers.splunk.com/answers/129424/how-to-compare-fields-over-multiple-sourcetypes-without-join-append-or-use-of-subsearches.html&lt;/A&gt; and watch the March 2016 virtual.conf talk from &lt;A href="http://wiki.splunk.com/Virtual_.conf"&gt;http://wiki.splunk.com/Virtual_.conf&lt;/A&gt; for more info how this can be done.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Sun, 10 Apr 2016 06:35:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269848#M81216</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-04-10T06:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269849#M81217</link>
      <description>&lt;P&gt;If this answered your question can you mark it as the answer please?&lt;/P&gt;

&lt;P&gt;Also see MuS's answer below.  Apparently it is more efficient than appendcols.  If you find that the search is faster or more reliable using his technique, then please mark his as the answer.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Apr 2016 12:06:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269849#M81217</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-04-10T12:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269850#M81218</link>
      <description>&lt;P&gt;I like the elegance of using OR and I will have to revisit some old searches.  &lt;/P&gt;

&lt;P&gt;Would this work for the op's scenario where they want a distinct count of events in two different indexes?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 00:04:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269850#M81218</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-04-11T00:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269851#M81219</link>
      <description>&lt;P&gt;of course:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal OR index=_audit 
| eval internal_count=if(index="_internal", 1, null()) 
| eval audit_count=if(index="_audit", 1, null()) 
| stats sum(internal_count) AS internal sum(audit_count) AS audit 
| eval diff=internal-audit
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Apr 2016 00:11:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269851#M81219</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-04-11T00:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269852#M81220</link>
      <description>&lt;P&gt;That's so awesome!  TYVM!!!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 00:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269852#M81220</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-04-11T00:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269853#M81221</link>
      <description>&lt;P&gt;How would you do that for comparing the count of two sourcetypes in one index?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 16:39:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269853#M81221</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2016-04-11T16:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to compare values from two different searches</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269854#M81222</link>
      <description>&lt;P&gt;Ah, got that figured out. And using your technique you can do it across two as well. Cool!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2016 17:44:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-compare-values-from-two-different-searches/m-p/269854#M81222</guid>
      <dc:creator>wrangler2x</dc:creator>
      <dc:date>2016-04-11T17:44:03Z</dc:date>
    </item>
  </channel>
</rss>

