<?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 you count the difference in an ongoing count for a given time period? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452186#M128044</link>
    <description>&lt;P&gt;Landen99, thanks for your answer.  &lt;/P&gt;

&lt;P&gt;This works, but I'm still getting the jvmDescription in my Singlevalue display. &lt;/P&gt;</description>
    <pubDate>Thu, 13 Sep 2018 19:52:52 GMT</pubDate>
    <dc:creator>stcrispan</dc:creator>
    <dc:date>2018-09-13T19:52:52Z</dc:date>
    <item>
      <title>How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452174#M128032</link>
      <description>&lt;P&gt;I have a JMX search going on which tracks orders placed every 30 seconds.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dot_jmx mbean_property_destinationName=RTGOrderProcessed |  stats values(Messages_Enqueue) AS Orders by jvmDescription, mbean_property_destinationName 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The search produces and output like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Server  Name        Orders
SRV1    Processed   11238 
SRV1    Processed   11239 
SRV1    Processed   11240 
SRV1    Processed   11241 
SRV1    Processed   11242 
SRV1    Processed   11243 
SRV1    Processed   11244 
SRV1    Processed   11246 
SRV1    Processed   11247 
SRV1    Processed   11248 
SRV1    Processed   11249 
SRV1    Processed   11250 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This goes in a dashboard with a picker, and for the time period provided by the picker, there should be a way to output a visualization which counts the difference between the earliest count number and the latest count number — the goal is to display the total new orders for the time period requested.   (So - displays the count for the last 15 minutes or the last week.)&lt;/P&gt;

&lt;P&gt;The guy before me had it like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dot_jmx destinationName=RTGOrderProcessed |  stats values(Messages_Enqueue) AS Orders by jvmDescription,destinationName| delta Orders as Orders p=1 | search Orders &amp;lt; 100| stats sum(Orders) As "Total Process Orders Today"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;...but for some reason, when I added the time picker, that stopped working...but the time picker is now a requirement, and the guy is gone. &lt;/P&gt;

&lt;P&gt;Any suggestions? &lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 15:46:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452174#M128032</guid>
      <dc:creator>stcrispan</dc:creator>
      <dc:date>2018-09-07T15:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452175#M128033</link>
      <description>&lt;P&gt;@stcrispan,&lt;BR /&gt;
Your requirement and what the guy before you have done is not matching :-). However, as per your statement, &lt;STRONG&gt;difference between the earliest count number and the latest count number&lt;/STRONG&gt; , you could use &lt;CODE&gt;eventstats&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=dot_jmx mbean_property_destinationName=RTGOrderProcessed |  stats values(Messages_Enqueue) AS Orders by jvmDescription, mbean_property_destinationName |eventstats earliest(Orders) as earliest,latest(Orders) as latest by jvmDescription, mbean_property_destinationName|eval diff=latest-earliest 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please lets know whats the changes you are looking for&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 16:20:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452175#M128033</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-09-07T16:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452176#M128034</link>
      <description>&lt;P&gt;When you say "stopped working", what do you mean?  What does it do now?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 16:21:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452176#M128034</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-09-07T16:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452177#M128035</link>
      <description>&lt;P&gt;renjith.nair, thank you for the fast response!&lt;/P&gt;

&lt;P&gt;Unfortunately, this is not working for me.  As I understand it, this was supposed to use the expression "eval diff" to take the difference between the earliest order and the latest order and then return that result?&lt;/P&gt;

&lt;P&gt;When I return the result in Visualization as a Single Value - I get back  the jvmDescription.  &lt;/P&gt;

&lt;P&gt;If I strip the command down, just to get the list of order counts, then run the stats command on it, I get the list of order counts in my Visualization as my Single Value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dot_jmx mbean_property_destinationName=RTGOrderProcessed |  stats values(Messages_Enqueue) as Orders | eventstats earliest(Orders) as earliest,latest(Orders) as latest |eval diff=latest-earliest
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;returns &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;11413,11414,11415,11417,11418,11419,11420,11421,11422,11423,11424,11425,11426,11427,11428,11429,11431
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thoughts? &lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 20:31:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452177#M128035</guid>
      <dc:creator>stcrispan</dc:creator>
      <dc:date>2018-09-07T20:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452178#M128036</link>
      <description>&lt;P&gt;DalJeanis,&lt;/P&gt;

&lt;P&gt;The original was supposed to provide a Single Value in the Visualization window.&lt;/P&gt;

&lt;P&gt;What it returns instead is the jvmDescription field. &lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 20:34:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452178#M128036</guid>
      <dc:creator>stcrispan</dc:creator>
      <dc:date>2018-09-07T20:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452179#M128037</link>
      <description>&lt;P&gt;@stcrispan, so you dont need earliest and latest but just the delta between the last two values. &lt;/P&gt;

&lt;P&gt;After adding the time picker, are you getting the value for the below search ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=dot_jmx destinationName=RTGOrderProcessed |  stats values(Messages_Enqueue) AS Orders by jvmDescription,destinationName| delta Orders as Orders p=1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If yes, then the filter &lt;CODE&gt;search Orders &amp;lt; 100&lt;/CODE&gt; is removing your results because for a larger time period the delta could be more. &lt;/P&gt;</description>
      <pubDate>Sat, 08 Sep 2018 03:21:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452179#M128037</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-09-08T03:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452180#M128038</link>
      <description>&lt;P&gt;Okay, the query doesn't make a whole lot of sense to me, and I'm usually pretty good at guessing this stuff.&lt;/P&gt;

&lt;P&gt;Based on the assumption that "Messages_Enqueue" is the value that is showing up in your "Order" column - even though your code will do nothing like that...then you can do something like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=dot_jmx destinationName=RTGOrderProcessed
 | eventstats min(Messages_Enqueue) as MinInRange
 | eval NetDiff=Messages_Enqueue - MinInRange
 | timechart span=15m max(NetDiff) as CumulativeTotal
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So via the above, you can timechart the value of NetDiff.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;However, I notice some gaps in your numbers, and the above ignores those missing numbers. So, you might need to do something like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=dot_jmx destinationName=RTGOrderProcessed
 | fields _time Messages_Enqueue
 | sort 0 _time  
 | dedup Messages_Enqueue
 | streamstats count as CumulativeTotal
 | timechart span=15m max(CumulativeTotal) as CumulativeTotal
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, I notice in the prior guy's code that he may be splitting by something or other, so in that case, you might need to do something like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=dot_jmx destinationName=RTGOrderProcessed
 | fields _time SomeSplitByField Messages_Enqueue
 | sort 0 _time  
 | dedup SomeSplitByField Messages_Enqueue
 | streamstats count as CumulativeTotal by SomeSplitByField
 | timechart span=15m max(CumulativeTotal) as CumulativeTotal by SomeSplitByField
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Obviously, you'll need to replace &lt;CODE&gt;SomeSplitByField&lt;/CODE&gt; with your actual split-by field(s)&lt;/P&gt;</description>
      <pubDate>Sat, 08 Sep 2018 22:53:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452180#M128038</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-09-08T22:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452181#M128039</link>
      <description>&lt;P&gt;hi @stcrispan ,&lt;/P&gt;

&lt;P&gt;were you able to check out the above answer? Did it work for you? If so, would you mind approving it so others can learn from it? Or, if it didn't work, would you mind updating us on your problem?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 16:58:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452181#M128039</guid>
      <dc:creator>mstjohn_splunk</dc:creator>
      <dc:date>2018-09-11T16:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452182#M128040</link>
      <description>&lt;P&gt;I actually do need the difference between the earliest and latest.  &lt;/P&gt;

&lt;P&gt;This query -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dot_activemq_jmx mbean_property_destinationName=RTGOrder |  stats values(Messages_Enqueue) AS Orders by jvmDescription, mbean_property_destinationName |eventstats earliest(Orders) as earliest,latest(Orders) as latest by jvmDescription, mbean_property_destinationName|eval diff=latest-earliest 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Does a listing of orders, incrementing, but does not populate the Single Value with that count, it populates it with the jvmDescription field. &lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 21:02:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452182#M128040</guid>
      <dc:creator>stcrispan</dc:creator>
      <dc:date>2018-09-12T21:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452183#M128041</link>
      <description>&lt;P&gt;Okie, try moving the count field as first field . for eg. yur search | fields count, other fields. If you are looking for a trend , then it normally against a time series. see  : &lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/7.0.3/Viz/SingleValueGenerate"&gt;http://docs.splunk.com/Documentation/SplunkCloud/7.0.3/Viz/SingleValueGenerate&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 03:25:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452183#M128041</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-09-13T03:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452184#M128042</link>
      <description>&lt;P&gt;I'm still muddling my way through these sophisticated queries you've provided.  I can say that they're not working like I was hoping they would work.  &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;  The one where someone took the series of numbers, picked the first number, then picked the last number (by time), and then did an eval of the difference between seemed so promising...but didn't actually work.   I'm not sure any more if it's my query or if it's my dataset....but the dataset does provide a list of numbers, I just need to get the delta of the change between first and last. &lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 12:37:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452184#M128042</guid>
      <dc:creator>stcrispan</dc:creator>
      <dc:date>2018-09-13T12:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452185#M128043</link>
      <description>&lt;P&gt;It most likely stopped working due to something other than the time picker addition.  I would have to webex with you to look more closely for the issue which stopped the search from working.  I recommend checking that the data is still coming in, that the fields are still being extracted, and that there are no time issues with the search.&lt;/P&gt;

&lt;P&gt;The search query provided looks like it will do the job, but I would optimize it a bit to make stats do more of the work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dot_jmx destinationName=RTGOrderProcessed | bucket _time span=1d | stats range(Messages_Enqueue) AS "Total Process Orders Today" by jvmDescription destinationName _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The fact that he screened out large orders indicates a potential worry about catching a period when the Messages_Enqueue value resets.  If that does not happen at midnight, consideration will need to be made for that.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 13:00:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452185#M128043</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2018-09-13T13:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452186#M128044</link>
      <description>&lt;P&gt;Landen99, thanks for your answer.  &lt;/P&gt;

&lt;P&gt;This works, but I'm still getting the jvmDescription in my Singlevalue display. &lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 19:52:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452186#M128044</guid>
      <dc:creator>stcrispan</dc:creator>
      <dc:date>2018-09-13T19:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452187#M128045</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=dot_activemq_jmx mbean_property_destinationName=RTGOrder | bucket _time span=1d | stats range(Messages_Enqueue) AS "Total Process Orders Today" by jvmDescription mbean_property_destinationName _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Sep 2018 19:53:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452187#M128045</guid>
      <dc:creator>stcrispan</dc:creator>
      <dc:date>2018-09-13T19:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452188#M128046</link>
      <description>&lt;P&gt;A little warning, with sort, dedup, and streamstats before the first reporting command, timechart, that search will perform poorly.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 21:31:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452188#M128046</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2018-09-13T21:31:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452189#M128047</link>
      <description>&lt;P&gt;It sounds like you might want a slightly different format for your single value:&lt;BR /&gt;
Assuming that you are only searching "today", _time can be removed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=dot_activemq_jmx mbean_property_destinationName=RTGOrder | stats range(Messages_Enqueue) AS "Total Process Orders Today" by jvmDescription
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there more than one value of jvmDescription?  If not, then you can get rid of that too in the stats command.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 21:36:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452189#M128047</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2018-09-13T21:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do you count the difference in an ongoing count for a given time period?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452190#M128048</link>
      <description>&lt;P&gt;Interesting...I only recently added a time picker to the dashboard, will removing the _time still allow the search to use the time specified by the time picker? &lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2018 15:19:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-count-the-difference-in-an-ongoing-count-for-a-given/m-p/452190#M128048</guid>
      <dc:creator>stcrispan</dc:creator>
      <dc:date>2018-09-17T15:19:17Z</dc:date>
    </item>
  </channel>
</rss>

