<?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 difference in field total over time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340318#M100932</link>
    <description>&lt;P&gt;Could you go into detail about what you're seeing? Without more information, I can't tweak the search.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2017 14:48:57 GMT</pubDate>
    <dc:creator>jluo_splunk</dc:creator>
    <dc:date>2017-09-18T14:48:57Z</dc:date>
    <item>
      <title>How to find difference in field total over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340315#M100929</link>
      <description>&lt;P&gt;I have event data in below format:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Sep 15 2017 07:06:07    app=yahoo    dataconsumed=50
Sep 15 2017 08:16:07    app=skype    dataconsumed=150
Sep 14 2017 10:26:07    app=facebook   dataconsumed=10
Sep 14 2017 12:26:07    app=facebook    dataconsumed=5
Sep 13 2017 7:26:07    app=yahoo    dataconsumed=10
Sep 13 2017 9:26:07    app=skype    dataconsumed=50
Sep 12 2017 3:26:07    app=facebook   dataconsumed=80
Sep 12 2017 1:26:07    app=facebook    dataconsumed=0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How should I perform the following tasks:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;For any given time range, search and split the events in to two halves of "day" or "hours"  i.e if "All Time" is selected as time range using Time Picker, I should be able to split above events into two halves by day(firsthalf=sep15-sep14 and secondhalf=sep 13-sep12) or by hour(firsthalf=48hour secondhalf=48hour).&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Then after splitting events into two halves, I must sum dataconsumed by app in both halves(events split by time) i.e&lt;/P&gt;

&lt;H2&gt;time    app    total_dataconsumed&lt;/H2&gt;

&lt;P&gt;firsthalf    yahoo    50&lt;BR /&gt;
                  skype    150&lt;/P&gt;

&lt;H2&gt;                  facebook    15&lt;/H2&gt;

&lt;P&gt;secondhalf    yahoo    10&lt;BR /&gt;
                        skype    50&lt;BR /&gt;
                        facebook    80&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Find difference between total_dataconsumed by app using firsthalf and secondhalf  i.e firsthalf  -  secindhalf&lt;/P&gt;

&lt;H2&gt;app    difference&lt;/H2&gt;

&lt;P&gt;yahoo    40&lt;BR /&gt;
skype    100&lt;BR /&gt;
facebook    -65&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;I am still stuck on step 1, I don't seem to understand how should one split the search events into halves/spans and apply stats on both halves?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 21:13:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340315#M100929</guid>
      <dc:creator>sohaibomar</dc:creator>
      <dc:date>2017-09-15T21:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to find difference in field total over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340316#M100930</link>
      <description>&lt;P&gt;There may be an easier way to do this, but you could try..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eventstats min(_time) as startTime, range(_time) as timeElapsed
| eval halfwayMark=startTime+(timeElapsed/2)
| eval series=if(_time&amp;lt;halfwayMark, "firstHalf", "secondHalf")
| chart sum(usage) by app, series
| eval diff=firstHalf-secondHalf
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Sep 2017 23:08:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340316#M100930</guid>
      <dc:creator>jluo_splunk</dc:creator>
      <dc:date>2017-09-15T23:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to find difference in field total over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340317#M100931</link>
      <description>&lt;P&gt;Thanks @jluo [Splunk], but I still can not get a difference between both halves.&lt;BR /&gt;
...|eval diff=firstHalf-secondHalf does not do anything.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 09:25:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340317#M100931</guid>
      <dc:creator>sohaibomar</dc:creator>
      <dc:date>2017-09-16T09:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to find difference in field total over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340318#M100932</link>
      <description>&lt;P&gt;Could you go into detail about what you're seeing? Without more information, I can't tweak the search.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 14:48:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340318#M100932</guid>
      <dc:creator>jluo_splunk</dc:creator>
      <dc:date>2017-09-18T14:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to find difference in field total over time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340319#M100933</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your Base Search Here
| addinfo
| eval time=if((_time &amp;lt;= (now()-(if(isnum(info_max_time), info_max_time, now()) - info_min_time)/2)), "firsthalf", "secondhalf")
| stats sum(dataconsumed) AS total_dataconsumed BY app time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Nov 2017 19:22:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-difference-in-field-total-over-time/m-p/340319#M100933</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-11-25T19:22:07Z</dc:date>
    </item>
  </channel>
</rss>

