<?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 convert the time and calculate the difference in a query? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-the-time-and-calculate-the-difference-in-a-query/m-p/605328#M105230</link>
    <description>&lt;P&gt;It is a little difficult to see what your data looks like from the picture, but assuming I have worked out the pattern correctly, try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=description "Last event received from \S+ : (?&amp;lt;description_time&amp;gt;\d+\-\d+\-\d+\s\d+:\d+)"
| where _time-strptime(description_time,"%Y-%d-%m %H:%M") &amp;gt; 60*60*24&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 12 Jul 2022 18:30:47 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-07-12T18:30:47Z</dc:date>
    <item>
      <title>How to convert the time and calculate the difference in a query?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-the-time-and-calculate-the-difference-in-a-query/m-p/605323#M105229</link>
      <description>&lt;P&gt;Hello Splunkers,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a query as follows&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;My query blah blah blah |stats latest(description) as description latest(result) as result latest(object) as object by host source _time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which gives the result as follows&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pavanae_1-1657648352473.png" style="width: 1206px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20497i9C00A90EEC88D717/image-dimensions/1206x70?v=v2" width="1206" height="70" role="button" title="pavanae_1-1657648352473.png" alt="pavanae_1-1657648352473.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;pavanae_1-1657648352473.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As highlighted with yellow color on the above results there are two different time values one under _time and the other under description.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I want to filter the results for the hosts that has more than 24 hours in the difference between _time and the time in the description. Something like below&amp;nbsp;&lt;/P&gt;&lt;P&gt;difference time = (_time - time_in_the_description) &amp;gt; 24 hours&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2022 17:57:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-the-time-and-calculate-the-difference-in-a-query/m-p/605323#M105229</guid>
      <dc:creator>pavanae</dc:creator>
      <dc:date>2022-07-12T17:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time and calculate the difference in a query?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-the-time-and-calculate-the-difference-in-a-query/m-p/605328#M105230</link>
      <description>&lt;P&gt;It is a little difficult to see what your data looks like from the picture, but assuming I have worked out the pattern correctly, try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=description "Last event received from \S+ : (?&amp;lt;description_time&amp;gt;\d+\-\d+\-\d+\s\d+:\d+)"
| where _time-strptime(description_time,"%Y-%d-%m %H:%M") &amp;gt; 60*60*24&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 12 Jul 2022 18:30:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-the-time-and-calculate-the-difference-in-a-query/m-p/605328#M105230</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-12T18:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time and calculate the difference in a query?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-the-time-and-calculate-the-difference-in-a-query/m-p/605330#M105231</link>
      <description>&lt;P&gt;Thanks for the response. the regex provided didn't worked. Let me provide the full syntax of the Description below&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Last event received from host_1 (ABCD-1234): 2022-12-06 23:59. logtype=ABC&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 12 Jul 2022 18:51:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-the-time-and-calculate-the-difference-in-a-query/m-p/605330#M105231</guid>
      <dc:creator>pavanae</dc:creator>
      <dc:date>2022-07-12T18:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert the time and calculate the difference in a query?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-the-time-and-calculate-the-difference-in-a-query/m-p/605332#M105232</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex field=description "Last event received from [^:]+: (?&amp;lt;description_time&amp;gt;\d+\-\d+\-\d+\s\d+:\d+)"
| where _time-strptime(description_time,"%Y-%d-%m %H:%M") &amp;gt; 60*60*24&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 12 Jul 2022 18:54:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-convert-the-time-and-calculate-the-difference-in-a-query/m-p/605332#M105232</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-07-12T18:54:21Z</dc:date>
    </item>
  </channel>
</rss>

