<?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 compute for duration between two consecutive timestamps in 1 field? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-compute-for-duration-between-two-consecutive-timestamps/m-p/428323#M75050</link>
    <description>&lt;P&gt;Ignore my other answer, I see you need to carry the time forward not backwards. Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats window=1 current=f last(_time) as prevTime last(GREEN) as prevGREEN last(YELLOW) as prevYELLOW last(RED) as prevRED
| eval duration = _time - prevTime
| table prevTime prevGREEN prevYELLOW prevRED duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Mar 2019 22:04:05 GMT</pubDate>
    <dc:creator>chrisyounger</dc:creator>
    <dc:date>2019-03-11T22:04:05Z</dc:date>
    <item>
      <title>How to compute for duration between two consecutive timestamps in 1 field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-compute-for-duration-between-two-consecutive-timestamps/m-p/428321#M75048</link>
      <description>&lt;P&gt;I have a table:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIME          | GREEN | YELLOW | RED | 
10:16:43              0             0              0
10:16:46              0             0              2
10:16:47              0             0              0
10:35:12              1             0              0
11:20:21              0             0              0
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to have another column for duration like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIME          | GREEN | YELLOW | RED |  DURATION |
10:16:43              0             0              0         00:00:03     ----------&amp;gt; meaning for 3 minutes, the values were 0 0 0
10:16:46              0             0              2         00:00:01     -----------&amp;gt;meaning for 1 minutes, red is 2
10:16:47              0             0              0         00:18:25     -----------&amp;gt; meaning fro 18:25, values are 0 0 0 
10:35:12              1             0              0         00:25:08     -----------&amp;gt; meaning for 25:08, green is at 1
11:20:21              0             0              0         00:06:43
11:07:04
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How will I do this?&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 21:23:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-compute-for-duration-between-two-consecutive-timestamps/m-p/428321#M75048</guid>
      <dc:creator>mdmaala</dc:creator>
      <dc:date>2019-03-11T21:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute for duration between two consecutive timestamps in 1 field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-compute-for-duration-between-two-consecutive-timestamps/m-p/428322#M75049</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats window=1 current=f last(_time) as prevTime
| eval duration = _time - prevTime
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2019 21:57:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-compute-for-duration-between-two-consecutive-timestamps/m-p/428322#M75049</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-03-11T21:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute for duration between two consecutive timestamps in 1 field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-compute-for-duration-between-two-consecutive-timestamps/m-p/428323#M75050</link>
      <description>&lt;P&gt;Ignore my other answer, I see you need to carry the time forward not backwards. Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats window=1 current=f last(_time) as prevTime last(GREEN) as prevGREEN last(YELLOW) as prevYELLOW last(RED) as prevRED
| eval duration = _time - prevTime
| table prevTime prevGREEN prevYELLOW prevRED duration
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Mar 2019 22:04:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-compute-for-duration-between-two-consecutive-timestamps/m-p/428323#M75050</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-03-11T22:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to compute for duration between two consecutive timestamps in 1 field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-compute-for-duration-between-two-consecutive-timestamps/m-p/428324#M75051</link>
      <description>&lt;P&gt;Thank you so much! this worked for me. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2019 01:33:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-compute-for-duration-between-two-consecutive-timestamps/m-p/428324#M75051</guid>
      <dc:creator>mdmaala</dc:creator>
      <dc:date>2019-03-12T01:33:24Z</dc:date>
    </item>
  </channel>
</rss>

