<?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 do I edit my search to find the difference between two fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260908#M78291</link>
    <description>&lt;P&gt;second one is more appropriate but the issue is notification column is vanished from it.&lt;/P&gt;</description>
    <pubDate>Tue, 02 Feb 2016 14:30:45 GMT</pubDate>
    <dc:creator>sunnyparmar</dc:creator>
    <dc:date>2016-02-02T14:30:45Z</dc:date>
    <item>
      <title>How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260897#M78280</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a search given below. All is working fine, but in last I want to sort out difference between total-acknowledged which I am not getting, so please suggest here.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(host="e2e-onp-front" response="Message acknowledged successfully*")    OR      (host= "e2e-onp-bl-db" DocumentNotificationHookServiceImpl Successfully created notification ) org=*|rex "Successfully (?&amp;lt;response&amp;gt;created) notification"|eval notifications=if(match(response,"created"),"      Total", "Acknowledged")| stats  count by notifications | eval Diff = Total - Acknowledged
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 12:54:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260897#M78280</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2016-02-02T12:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260898#M78281</link>
      <description>&lt;P&gt;Are you sure your base query is producing events with Total and Acknowledged fields?  Without the fields, a difference cannot be computed.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:03:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260898#M78281</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-02-02T13:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260899#M78282</link>
      <description>&lt;P&gt;thanks for answering.. yes my base query is production events with total=38 and acknowledged=2 so i want the rest of the difference 36 to be shown in dashboard with these two values.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:05:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260899#M78282</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2016-02-02T13:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260900#M78283</link>
      <description>&lt;P&gt;Case is significant with field names.  If the names are "total" and "acknowledged" then your query must be &lt;CODE&gt;... | eval Diff = total - acknowledged&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:12:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260900#M78283</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-02-02T13:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260901#M78284</link>
      <description>&lt;P&gt;Try a bit different approach. Join the eval in the stats, something like below. You might need to adjust for your final requirements&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (host="e2e-onp-front" response="Message acknowledged successfully*")      OR        (host= "e2e-onp-bl-db" DocumentNotificationHookServiceImpl Successfully created notification ) org=*|rex "Successfully (?&amp;lt;response&amp;gt;created) notification"|stats count(eval(like(response,"%created%"))) AS Total, count(eval(NOT like(response,"%created%"))) as Acknowledge| eval Diff = Total - Acknowledged
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:14:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260901#M78284</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-02-02T13:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260902#M78285</link>
      <description>&lt;P&gt;in both words first alphabet are capital like i have pasted in my own query. &lt;/P&gt;

&lt;P&gt;| eval Diff = Total - Acknowledged&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:15:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260902#M78285</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2016-02-02T13:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260903#M78286</link>
      <description>&lt;P&gt;thanks for replying but still getting no difference with the query. Even by executing your query i have lost my notification column under which "Total" and "Acknowledged" parameters showing previously. Now it is showing only Total=38 and Acknowledged=2 columns. Notification column is vanished. &lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:22:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260903#M78286</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2016-02-02T13:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260904#M78287</link>
      <description>&lt;P&gt;Diff is not showing since there is a typo ie : &lt;CODE&gt;| eval Diff = Total - Acknowledge&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;In your first search , the &lt;CODE&gt;Total&lt;/CODE&gt; and &lt;CODE&gt;Acknowledged&lt;/CODE&gt; are on diff rows (ie: stats count by notification). So where do you want to dislpay the difference? &lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:46:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260904#M78287</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-02-02T13:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260905#M78288</link>
      <description>&lt;P&gt;i want to display it in the dashboard result.. Currently i am getting two columns. first is notifications under which i am getting "Total" and "Acknowledged" values and other one is count column under which i am getting "38" and "2" values respectively so now i want third column in which it will show the difference of Total-Acknowledged.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:57:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260905#M78288</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2016-02-02T13:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260906#M78289</link>
      <description>&lt;P&gt;Yes, got it, Your result is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;notification                  count
Acknowledged            38
Total                             2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So in third column, which row you want to display the diff ? &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Easiest method is using &lt;CODE&gt;delta&lt;/CODE&gt; ie : &lt;CODE&gt;| stats  count by notifications | delta count as diff p=1&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;If you want to transpose the complete table, then use&lt;/P&gt;

&lt;P&gt;your search| stats count by notification|transpose 2|rename "row 1" as Acknowledged,"row 2" as Total|eval Diff=Total-Acknowledged|search column=count&lt;BR /&gt;
|fields - column&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;If you want to print diff in all columns&lt;/P&gt;

&lt;P&gt;your search |stats count by notification|streamstats last(count) as newcount current=f|eval Diff=newcount-count|eventstats last(Diff) as Diff|fields - newcount&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 02 Feb 2016 14:10:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260906#M78289</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-02-02T14:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260907#M78290</link>
      <description>&lt;P&gt;Thanks.. You are close enough but displaying result is not exact.. Could you please rearrange these?&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;| stats count by notifications | delta count as diff p=1&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;notification                  count       diff&lt;BR /&gt;
 Acknowledged            38&lt;BR /&gt;
 Total                             2                 36&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;your search| stats count by notification|transpose 2|rename "row 1" as Acknowledged,"row 2" as Total|eval Diff=Total-Acknowledged|search column=count|fields - column&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Acknowledged    Total   Diff&lt;BR /&gt;
2                             38             36 &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt; your search |stats count by notification|streamstats last(count) as newcount current=f|eval Diff=newcount-count|eventstats last(Diff) as Diff|fields - newcount&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;notifications   count   Diff&lt;BR /&gt;
Acknowledged    2   -36&lt;BR /&gt;
Total                 38    -36 &lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 14:29:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260907#M78290</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2016-02-02T14:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260908#M78291</link>
      <description>&lt;P&gt;second one is more appropriate but the issue is notification column is vanished from it.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 14:30:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260908#M78291</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2016-02-02T14:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260909#M78292</link>
      <description>&lt;P&gt;In the second one, the notification is transposed as Acknowledged and Total and the correspoding counts are shown under each column. Where do you wantto display &lt;EM&gt;notification&lt;/EM&gt; now? How should be your final result looks like?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 15:01:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260909#M78292</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-02-02T15:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260910#M78293</link>
      <description>&lt;P&gt;final result will be look like -&lt;/P&gt;

&lt;P&gt;notification                Counts&lt;BR /&gt;
Total                               38&lt;BR /&gt;
Acknowledged                2&lt;BR /&gt;
Difference                      36&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 05:34:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260910#M78293</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2016-02-03T05:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260911#M78294</link>
      <description>&lt;P&gt;Alright. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     (host="e2e-onp-front" response="Message acknowledged successfully*") OR (host= "e2e-onp-bl-db" DocumentNotificationHookServiceImpl Successfully created notification ) org=*
     |rex "Successfully (?&amp;lt;response&amp;gt;created) notification"|eval notifications=if(match(response,"created"),"Total", "Acknowledged")
     |stats  count by notifications
     |delta count as Difference p=1| appendpipe [|stats values(Difference) as Difference|eval notifications="Difference"|eval count=Difference]|fields - Difference
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Feb 2016 06:07:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260911#M78294</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-02-03T06:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260912#M78295</link>
      <description>&lt;P&gt;Great buddy.. thanks a ton...&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 06:12:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260912#M78295</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2016-02-03T06:12:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the difference between two fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260913#M78296</link>
      <description>&lt;P&gt;Hello sunnyparmer,&lt;BR /&gt;
                     i just changed order of the queries and changed stats to eventstats in the query ........I actually worked on my data with a similar query it is working fine..this is just due to the fact stats cannot pass data to another stats command in chain you have to  use eventstats for that....i am sending screenshot of my query and data....&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/95171-demo11.jpg" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;(host="e2e-onp-front" response="Message acknowledged successfully*")      OR        (host= "e2e-onp-bl-db" DocumentNotificationHookServiceImpl Successfully created notification ) org=&lt;EM&gt;|rex "Successfully (?created) notification"|&lt;/EM&gt;&lt;EM&gt;eventstats  count by notifications&lt;/EM&gt;*|stats count(eval(like(response,"%created%"))) AS Total, count(eval(NOT like(response,"%created%"))) as Acknowledge| eval Diff = Total - Acknowledged...&lt;BR /&gt;
                                                                                                  Let me know if it works&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:39:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-difference-between-two/m-p/260913#M78296</guid>
      <dc:creator>rakeshh123</dc:creator>
      <dc:date>2020-09-29T08:39:16Z</dc:date>
    </item>
  </channel>
</rss>

