<?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 subtracting 2 timestamps and then evaluating if that result is longer than 1 hour in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/subtracting-2-timestamps-and-then-evaluating-if-that-result-is/m-p/558479#M158646</link>
    <description>&lt;P&gt;I have two timestamps that are in this format within my log events:&lt;/P&gt;&lt;P&gt;start: 2005-07-05T04:28:34.453494Z&lt;/P&gt;&lt;P&gt;end: 2005-07-05T05:28:39.462681Z&lt;/P&gt;&lt;P&gt;I would like to subtract the timestamps then evaluate them to see if the result is greater or equal to 1 hour and include that event in my query results&lt;/P&gt;&lt;P&gt;Extra:&lt;/P&gt;&lt;P&gt;if so how long?&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jul 2021 21:16:07 GMT</pubDate>
    <dc:creator>samnew4598</dc:creator>
    <dc:date>2021-07-06T21:16:07Z</dc:date>
    <item>
      <title>subtracting 2 timestamps and then evaluating if that result is longer than 1 hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subtracting-2-timestamps-and-then-evaluating-if-that-result-is/m-p/558479#M158646</link>
      <description>&lt;P&gt;I have two timestamps that are in this format within my log events:&lt;/P&gt;&lt;P&gt;start: 2005-07-05T04:28:34.453494Z&lt;/P&gt;&lt;P&gt;end: 2005-07-05T05:28:39.462681Z&lt;/P&gt;&lt;P&gt;I would like to subtract the timestamps then evaluate them to see if the result is greater or equal to 1 hour and include that event in my query results&lt;/P&gt;&lt;P&gt;Extra:&lt;/P&gt;&lt;P&gt;if so how long?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 21:16:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subtracting-2-timestamps-and-then-evaluating-if-that-result-is/m-p/558479#M158646</guid>
      <dc:creator>samnew4598</dc:creator>
      <dc:date>2021-07-06T21:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: subtracting 2 timestamps and then evaluating if that result is longer than 1 hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subtracting-2-timestamps-and-then-evaluating-if-that-result-is/m-p/558485#M158649</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex "start: (?&amp;lt;start&amp;gt;\d{4}\-\d\d\-\d\dT\d\d:\d\d:\d\d\.\d+Z)"
| rex "end: (?&amp;lt;end&amp;gt;\d{4}\-\d\d\-\d\dT\d\d:\d\d:\d\d\.\d+Z)"
| eval start=strptime(start,"%Y-%m-%dT%H:%M:%S.%6QZ")
| eval end=strptime(end,"%Y-%m-%dT%H:%M:%S.%6QZ")
| eval diff=end-start
| where diff&amp;gt;=(60*60)
| fieldformat diff=tostring(diff,"duration")&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 06 Jul 2021 22:23:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subtracting-2-timestamps-and-then-evaluating-if-that-result-is/m-p/558485#M158649</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-06T22:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: subtracting 2 timestamps and then evaluating if that result is longer than 1 hour</title>
      <link>https://community.splunk.com/t5/Splunk-Search/subtracting-2-timestamps-and-then-evaluating-if-that-result-is/m-p/558582#M158685</link>
      <description>&lt;P&gt;This works great! If you have time can you explain it a bit, I don't know why we need to use "rex" to extract the time? I get the rest of the query as that was one of my initial tries but without the rex. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 14:53:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/subtracting-2-timestamps-and-then-evaluating-if-that-result-is/m-p/558582#M158685</guid>
      <dc:creator>samnew4598</dc:creator>
      <dc:date>2021-07-07T14:53:32Z</dc:date>
    </item>
  </channel>
</rss>

