<?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 How to get total number of hours elapsed from last event raised till now()? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-number-of-hours-elapsed-from-last-event-raised/m-p/627941#M218157</link>
    <description>&lt;P&gt;Hey people,&lt;/P&gt;
&lt;P&gt;I want to find out the total number of hours that elapsed from the last event raised.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I was doing previously:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| stats latest(_time) as last_log_time  | eval timeElapsedSinceLastLog=tostring(now() - last_log_time) | fieldformat timeElapsedSinceLastLog = strftime(timeElapsedSinceLastLog, "%H:%M:%S") |fields timeElapsedSinceLastLog&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this gives me&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sjs_0-1674454009705.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23495i58A108F18838641C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sjs_0-1674454009705.png" alt="sjs_0-1674454009705.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it has been more than a week, since the last event raised&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am also happy, if I could get number of days elapsed with time(if days &amp;lt; 1) as well.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jan 2023 19:19:38 GMT</pubDate>
    <dc:creator>sjs</dc:creator>
    <dc:date>2023-01-23T19:19:38Z</dc:date>
    <item>
      <title>How to get total number of hours elapsed from last event raised till now()?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-number-of-hours-elapsed-from-last-event-raised/m-p/627941#M218157</link>
      <description>&lt;P&gt;Hey people,&lt;/P&gt;
&lt;P&gt;I want to find out the total number of hours that elapsed from the last event raised.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I was doing previously:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| stats latest(_time) as last_log_time  | eval timeElapsedSinceLastLog=tostring(now() - last_log_time) | fieldformat timeElapsedSinceLastLog = strftime(timeElapsedSinceLastLog, "%H:%M:%S") |fields timeElapsedSinceLastLog&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this gives me&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sjs_0-1674454009705.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/23495i58A108F18838641C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sjs_0-1674454009705.png" alt="sjs_0-1674454009705.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it has been more than a week, since the last event raised&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am also happy, if I could get number of days elapsed with time(if days &amp;lt; 1) as well.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 19:19:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-number-of-hours-elapsed-from-last-event-raised/m-p/627941#M218157</guid>
      <dc:creator>sjs</dc:creator>
      <dc:date>2023-01-23T19:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Get total number of hours elapsed from last event raised till now()</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-number-of-hours-elapsed-from-last-event-raised/m-p/627943#M218158</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252815"&gt;@sjs&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;You can divide the elapsed time with 86400 to get the number of days, try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats latest(_time) as last_log_time 
| eval timeElapsedSinceLastLog=now() - last_log_time, days=round(timeElapsedSinceLastLog/86400, 0) 
| eval timeElapsedSinceLastLog = strftime(timeElapsedSinceLastLog, "%H:%M:%S") 
| eval timeElapsedSinceLastLog=if(days &amp;gt; 0, days." days, ".timeElapsedSinceLastLog, timeElapsedSinceLastLog) 
| fields timeElapsedSinceLastLog&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 07:01:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-total-number-of-hours-elapsed-from-last-event-raised/m-p/627943#M218158</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2023-01-23T07:01:53Z</dc:date>
    </item>
  </channel>
</rss>

