<?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 find the difference between the results of two different searches in one search to display in a table panel? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158517#M44661</link>
    <description>&lt;P&gt;If you can provide more detail about your base searches, it may be possible to combine them so you have a single query.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Aug 2015 19:07:31 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2015-08-10T19:07:31Z</dc:date>
    <item>
      <title>How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158516#M44660</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I hope you can help me with this,&lt;BR /&gt;
I have 2 search results and I want to get the difference between both in the same search to display it in a table panel.&lt;/P&gt;

&lt;P&gt;So.. &lt;BR /&gt;
search events 1:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;New apps retrieved | stats values(Count) as Apps_retrieved | Table _time, Apps_retrieved
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;search events 2:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Apps_Assignment: apps generated in  | stats values(Count) as Apps_generated | Table _time, Apps_generated
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So, basically what I need is to get:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{(search events 1) - (search events 2)} | timechart span=1h count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or some way to expose this difference in 1h intervals.&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2015 18:24:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158516#M44660</guid>
      <dc:creator>msalaverry</dc:creator>
      <dc:date>2015-08-10T18:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158517#M44661</link>
      <description>&lt;P&gt;If you can provide more detail about your base searches, it may be possible to combine them so you have a single query.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2015 19:07:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158517#M44661</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-08-10T19:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158518#M44662</link>
      <description>&lt;P&gt;If I understand this correctly, you want to find the difference between timestamps which will show you how long an event took to process?&lt;/P&gt;

&lt;P&gt;You first need to see what the events have in common, usually they have a unique identifier tied to each request/response pair. Then you can pipe it into a transaction or stats command which will then group them. Then you will pipe it into a timechart &lt;/P&gt;

&lt;P&gt;If it doesn't have a unique identifier and is in the same index, you can then use startswith="start" and endswith="ends"&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=whatever | transaction startswith="start" endswith="end" | timechart avg(duration)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Aug 2015 19:18:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158518#M44662</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-08-10T19:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158519#M44663</link>
      <description>&lt;P&gt;Hi richgalloway, &lt;BR /&gt;
Well the log statements I'm looking for are:&lt;BR /&gt;
- Apps_Assignment: New apps retrieved. Count={}&lt;BR /&gt;
- Apps_Assignment: apps generated in {} millis. Count={}&lt;/P&gt;

&lt;P&gt;This process will shown the first log at the begining, and the second one at the end. And I want to get difference between the initial value of count and the final. This process run once every hour.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:54:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158519#M44663</guid>
      <dc:creator>msalaverry</dc:creator>
      <dc:date>2020-09-29T06:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158520#M44664</link>
      <description>&lt;P&gt;Maybe I didn't explained correctly.&lt;BR /&gt;
As I said to richgalloway:&lt;/P&gt;

&lt;P&gt;the log statements I'm looking for are:&lt;BR /&gt;
- Apps_Assignment: New apps retrieved. Count={}&lt;BR /&gt;
- Apps_Assignment: apps generated in {} millis. Count={}&lt;/P&gt;

&lt;P&gt;This process will shown the first log at the begining, and the second one at the end. And I want to get difference between the initial value of count and the final. This process run once every hour.*&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:54:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158520#M44664</guid>
      <dc:creator>msalaverry</dc:creator>
      <dc:date>2020-09-29T06:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158521#M44665</link>
      <description>&lt;P&gt;Try this and let me know if it works.. It may need some tweeking as its untested &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"New apps retreived" OR "New apps generated" | stats count values(Apps_retrieved) values(Apps_generated)  | eval Diff = Apps_retrieved - Apps_generated | timechart count(Diff) span=1h
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Aug 2015 19:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158521#M44665</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-08-10T19:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158522#M44666</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Below is the sample query,&lt;/P&gt;

&lt;P&gt;index=whatever | transaction statrtswith="Apps_Assignment: New apps retrieved" maxspan=1h |  stats values(Count) as Apps_Assignment | stats first(Apps_Assignment ) as Initial_Apps_Assignment  | eval apps_assignment_time = _time | Table apps_assignment_time , Initial_Apps_Assignment | transaction startswith="Apps_Assignment: apps generated" maxspan=1h |  stats values(Count) as Assignment_app | stats last(Assignment_app ) as final_Assignment_app  | eval Assignment_app_time = _time | Table Assignment_app_time , final_Assignment_app &lt;/P&gt;

&lt;P&gt;Hope this will help you&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Badri Srinivas B&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:56:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158522#M44666</guid>
      <dc:creator>sbbadri</dc:creator>
      <dc:date>2020-09-29T06:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158523#M44667</link>
      <description>&lt;P&gt;transaction startswith="Apps_Assignment: New apps retrieved" doesn't return anything. Even, I don't know what's this command. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2015 20:27:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158523#M44667</guid>
      <dc:creator>msalaverry</dc:creator>
      <dc:date>2015-08-10T20:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158524#M44668</link>
      <description>&lt;P&gt;"New apps retreived" OR "New apps generated" | stats count values(Apps_retrieved) values(Apps_generated)  &lt;/P&gt;

&lt;P&gt;returns:&lt;BR /&gt;
count | Apps_retrieved | Apps_generated&lt;BR /&gt;
 88      |                             |&lt;/P&gt;

&lt;P&gt;Looks like "count" contains the sum of retrieved and generated. But we're not getting them separately.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:54:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158524#M44668</guid>
      <dc:creator>msalaverry</dc:creator>
      <dc:date>2020-09-29T06:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158525#M44669</link>
      <description>&lt;P&gt;The transaction command only groups independent events together.. So if you have 2 events, 1 is a request and the other is a response. &lt;/P&gt;

&lt;P&gt;Event 1 has the words "request" and event 2 has "response", you can then jon those 2 events into 1 event by doing this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=whatever | transaction starswith="request" endswith="response" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once you have 1 event, you can then easily find the duration between then 2 events.. &lt;/P&gt;

&lt;P&gt;I don't think this applies to what the original question stated as it wasn't clearly defined. It looks like you want to take 2 searches and combine them together, then do an | eval and subtract those fields and plot the results vs time, is this correct? &lt;/P&gt;

&lt;P&gt;If so, then give me some sample data and I'll fix your search &lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2015 20:39:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158525#M44669</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2015-08-10T20:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158526#M44670</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     New apps retrieved | timechart span=1h values(Count) as Apps_retrieved | appendcols [search Apps_Assignment: apps generated in  | timechart span=1h values(Count) as Apps_generated ] | eval Difference=Apps_retrieved-Apps_generated
| table _time, Difference
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Aug 2015 20:50:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158526#M44670</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-08-10T20:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to find the difference between the results of two different searches in one search to display in a table panel?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158527#M44671</link>
      <description>&lt;P&gt;Awesome!. That's exactly what I need... Thanks somesoni2 ... &lt;BR /&gt;
Also thanks to everyone else. You guys rock!.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Aug 2015 21:16:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-the-difference-between-the-results-of-two-different/m-p/158527#M44671</guid>
      <dc:creator>msalaverry</dc:creator>
      <dc:date>2015-08-10T21:16:14Z</dc:date>
    </item>
  </channel>
</rss>

