<?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 Using variable &amp;quot;total_dataconsumed&amp;quot; how do I find biggest gainer/loser (per 24-hour period) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340546#M101006</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;For example: for above dataset:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|if( ((total_dataconsumed by app in last half of time) - (total_dataconsumed by app in fprevious half of time) ) &amp;gt;0, "gainer", "loser")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for above sample dataset result would be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;app gainer_or_loser dataconsumed
----------------------------------------------------
yahoo gainer 40
skype gainer 100
facebook loser -65
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 16 Sep 2017 09:53:32 GMT</pubDate>
    <dc:creator>sohaibomar</dc:creator>
    <dc:date>2017-09-16T09:53:32Z</dc:date>
    <item>
      <title>Using variable "total_dataconsumed" how do I find biggest gainer/loser (per 24-hour period)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340546#M101006</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;For example: for above dataset:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...|if( ((total_dataconsumed by app in last half of time) - (total_dataconsumed by app in fprevious half of time) ) &amp;gt;0, "gainer", "loser")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for above sample dataset result would be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;app gainer_or_loser dataconsumed
----------------------------------------------------
yahoo gainer 40
skype gainer 100
facebook loser -65
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Sep 2017 09:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340546#M101006</guid>
      <dc:creator>sohaibomar</dc:creator>
      <dc:date>2017-09-16T09:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using variable "total_dataconsumed" how do I find biggest gainer/loser (per 24-hour period)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340547#M101007</link>
      <description>&lt;P&gt;hmm are these columns in a CSV file or what is the format of the data source? The result needs a bit tweaking based on your data source&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 12:27:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340547#M101007</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2017-09-16T12:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using variable "total_dataconsumed" how do I find biggest gainer/loser (per 24-hour period)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340548#M101008</link>
      <description>&lt;P&gt;I tried this with your events in a notepad as follows:&lt;BR /&gt;
Sep 15 2017 07:06:07    app=yahoo    dataconsumed=50&lt;BR /&gt;
Sep 15 2017 08:16:07    app=skype    dataconsumed=150&lt;BR /&gt;
Sep 14 2017 10:26:07    app=facebook   dataconsumed=10&lt;BR /&gt;
Sep 14 2017 12:26:07    app=facebook    dataconsumed=5&lt;BR /&gt;
Sep 13 2017 7:26:07    app=yahoo    dataconsumed=10&lt;BR /&gt;
Sep 13 2017 9:26:07    app=skype    dataconsumed=50&lt;BR /&gt;
Sep 12 2017 3:26:07    app=facebook   dataconsumed=80&lt;/P&gt;

&lt;H1&gt;Sep 12 2017 1:26:07    app=facebook    dataconsumed=0&lt;/H1&gt;

&lt;P&gt;|  eval t=strftime(_time,"%Y-%m-%d")&lt;BR /&gt;
| eval t1=strptime(t,"%Y-%m-%d")&lt;BR /&gt;
| eval d=strftime(relative_time(now(),"-2d"),"%Y-%m-%d")&lt;BR /&gt;
| eventstats max(t1) as f by app &lt;BR /&gt;
| eval d1=t1-f&lt;BR /&gt;
| eval c=if(f=t1,"c",if(d1=d,"p","nc"))&lt;BR /&gt;
| chart sum(dataconsumed) by app,c &lt;BR /&gt;
| eval dataconsumed=c-nc &lt;BR /&gt;
|eval gainer_or_looser=if(dataconsumed &amp;gt;0,"gainer",if(dataconsumed=0,"even","looser")) &lt;BR /&gt;
|  fields app,gainer_or_looser,dataconsumed &lt;BR /&gt;
| sort - app&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:46:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340548#M101008</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2020-09-29T15:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using variable "total_dataconsumed" how do I find biggest gainer/loser (per 24-hour period)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340549#M101009</link>
      <description>&lt;P&gt;The data is in simple txt file. Splunk is easily able to extract time and fields out of it&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 14:04:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340549#M101009</guid>
      <dc:creator>sohaibomar</dc:creator>
      <dc:date>2017-09-16T14:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using variable "total_dataconsumed" how do I find biggest gainer/loser (per 24-hour period)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340550#M101010</link>
      <description>&lt;P&gt;hi please my answer below in details, i posted it as a separate entry&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 14:25:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-variable-quot-total-dataconsumed-quot-how-do-I-find/m-p/340550#M101010</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2017-09-16T14:25:20Z</dc:date>
    </item>
  </channel>
</rss>

