<?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: Calculate delta for corresponding fields base on time grouped events in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163034#M46268</link>
    <description>&lt;P&gt;Ah. Append this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eventstats sum(delta_field_1) by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 24 Feb 2014 22:44:35 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-02-24T22:44:35Z</dc:date>
    <item>
      <title>Calculate delta for corresponding fields base on time grouped events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163029#M46263</link>
      <description>&lt;P&gt;Need ideas on how to do field calculations based on 2 sets of transactions. Data file is as follows :&lt;/P&gt;

&lt;P&gt;Timestamp_1 field_1 field_2 field_3 field_4 id_1&lt;BR /&gt;&lt;BR /&gt;
Timestamp_1 field_1 field_2 field_3 field_4 id_2&lt;BR /&gt;&lt;BR /&gt;
Timestamp_1 field_1 field_2 field_3 field_4 id_3&lt;BR /&gt;&lt;BR /&gt;
Timestamp_1 field_1 field_2 field_3 field_4 id_4  &lt;/P&gt;

&lt;P&gt;Timestamp_2 field_1 field_2 field_3 field_4 id_1&lt;BR /&gt;&lt;BR /&gt;
Timestamp_2 field_1 field_2 field_3 field_4 id_2&lt;BR /&gt;&lt;BR /&gt;
Timestamp_2 field_1 field_2 field_3 field_4 id_3&lt;BR /&gt;&lt;BR /&gt;
Timestamp_2 field_1 field_2 field_3 field_4 id_4  &lt;/P&gt;

&lt;P&gt;Timestamp_3 field_1 field_2 field_3 field_4 id_1&lt;BR /&gt;&lt;BR /&gt;
Timestamp_3 field_1 field_2 field_3 field_4 id_2&lt;BR /&gt;&lt;BR /&gt;
Timestamp_3 field_1 field_2 field_3 field_4 id_3&lt;BR /&gt;&lt;BR /&gt;
Timestamp_3 field_1 field_2 field_3 field_4 id_4  &lt;/P&gt;

&lt;P&gt;Multiple events have same timestamp (Timestamp_1, Timestamp_2...) at regular intervals. Field_1 .. to Field_4 are cumulative from previous identical timestamped fields.&lt;BR /&gt;&lt;BR /&gt;
First part:&lt;BR /&gt;&lt;BR /&gt;
Need to calculate DELTA by comparing previous event for the same id_1, id_2 ..etc&lt;BR /&gt;
Eg. need to calculate  Delta as follows :&lt;BR /&gt;&lt;BR /&gt;
Timestamp2 Field_1 - Timestamp_1 field_1&lt;BR /&gt;&lt;BR /&gt;
Timestamp3 Field_1 - Timestamp_2 field_1  &lt;/P&gt;

&lt;P&gt;Second part:&lt;BR /&gt;&lt;BR /&gt;
Add the DELTAs for field_1, field_2... per time interval, so&lt;/P&gt;

&lt;P&gt;Timestamp_2 field-delta_1 field-delta_2 field-delta_3 field_4 id_1&lt;BR /&gt;&lt;BR /&gt;
Timestamp_2 field-delta_1 field-delta_2 field-delta_3 field_4 id_2&lt;BR /&gt;&lt;BR /&gt;
Timestamp_2 field-delta_1 field-delta_2 field-delta_3 field_4 id_3&lt;BR /&gt;&lt;BR /&gt;
Timestamp_2 field-delta_1 field-delta_2 field-delta_3 field_4 id_4  &lt;/P&gt;

&lt;P&gt;Sum of field-delta_1 for all id_?s &lt;/P&gt;

&lt;P&gt;Appreciate any help/pointers with this !!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:57:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163029#M46263</guid>
      <dc:creator>noveix</dc:creator>
      <dc:date>2020-09-28T15:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate delta for corresponding fields base on time grouped events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163030#M46264</link>
      <description>&lt;P&gt;For calculating deltas split by a field you can use streamstats:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | streamstats current=f window=1 last(field) as last_field by split_field | eval delta_field = field - last_field
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Not sure what you mean by the second part, could you elaborate?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2014 10:38:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163030#M46264</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-02-24T10:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate delta for corresponding fields base on time grouped events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163031#M46265</link>
      <description>&lt;P&gt;Thanks Martin, that works, for the second part .. I need to sum the deltas for all of the id_# for the same timestamp .. using my example data above, deltas for the 4 events which has identical timestamp.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2014 11:11:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163031#M46265</guid>
      <dc:creator>noveix</dc:creator>
      <dc:date>2014-02-24T11:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate delta for corresponding fields base on time grouped events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163032#M46266</link>
      <description>&lt;P&gt;Do you want to sum up several fields in one event or sum up one field over several events - or both?&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2014 11:53:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163032#M46266</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-02-24T11:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate delta for corresponding fields base on time grouped events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163033#M46267</link>
      <description>&lt;P&gt;I want to sum up delta of field_1 for all events that have the same timestamp regardless of the id_#&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:58:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163033#M46267</guid>
      <dc:creator>noveix</dc:creator>
      <dc:date>2020-09-28T15:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate delta for corresponding fields base on time grouped events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163034#M46268</link>
      <description>&lt;P&gt;Ah. Append this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eventstats sum(delta_field_1) by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Feb 2014 22:44:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163034#M46268</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-02-24T22:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate delta for corresponding fields base on time grouped events</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163035#M46269</link>
      <description>&lt;P&gt;great work ... works nicely !!&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2014 23:12:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Calculate-delta-for-corresponding-fields-base-on-time-grouped/m-p/163035#M46269</guid>
      <dc:creator>noveix</dc:creator>
      <dc:date>2014-02-24T23:12:14Z</dc:date>
    </item>
  </channel>
</rss>

