<?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: Find Time between events, including current Time. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-Time-between-events-including-current-Time/m-p/418852#M120414</link>
    <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search
| streamstats window=1 current=f values(_time) as last_time by field 
| eval last_time=if(isnull(last_time),now(),last_time)
| eval outage= abs(last_time - _time)
| where outage&amp;gt;600
| eval outage=tostring(outage, "duration")
| table field _time outage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 22 Aug 2018 16:18:23 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2018-08-22T16:18:23Z</dc:date>
    <item>
      <title>Find Time between events, including current Time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-Time-between-events-including-current-Time/m-p/418851#M120413</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;I've seen examples of how to find time between events using &lt;CODE&gt;streamstats&lt;/CODE&gt;, and also to find the time since the most recent event using &lt;CODE&gt;stats&lt;/CODE&gt;, but how would I accomplish doing both?&lt;/P&gt;

&lt;P&gt;Ultimately I'm trying to detect a loss of information that's reported every 10 minutes, so I'm using streamstats to search for differences of &amp;gt; 10 min, however this "outage" isn't detected until after the data is reported again, thus giving streamstats two items to actually compare. I need all of these deltas, and also the time since the most recent as occurred.&lt;/P&gt;

&lt;P&gt;Thanks, and here's some code I have:&lt;/P&gt;

&lt;P&gt;search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| streamstats current=t last(_time) as last_time by field 
| eval outage= last_time - _time
| eval outage=tostring(outage, "duration")
| table field _time outage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Aug 2018 13:23:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-Time-between-events-including-current-Time/m-p/418851#M120413</guid>
      <dc:creator>jrnastase</dc:creator>
      <dc:date>2018-08-22T13:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Find Time between events, including current Time.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-Time-between-events-including-current-Time/m-p/418852#M120414</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search
| streamstats window=1 current=f values(_time) as last_time by field 
| eval last_time=if(isnull(last_time),now(),last_time)
| eval outage= abs(last_time - _time)
| where outage&amp;gt;600
| eval outage=tostring(outage, "duration")
| table field _time outage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Aug 2018 16:18:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-Time-between-events-including-current-Time/m-p/418852#M120414</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-08-22T16:18:23Z</dc:date>
    </item>
  </channel>
</rss>

