<?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 Difference between latest log time and system time in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Difference-between-latest-log-time-and-system-time/m-p/560514#M92646</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have one field that simply shows that latest timestamp of logs.&lt;/P&gt;&lt;P&gt;i) I was wondering how can I find the difference between the latest log time and the current system time?&lt;/P&gt;&lt;P&gt;ii) Then with that value I was hoping to check run a condition and print the condition to another field (e.g. timeliness). The condition I wanted to implemented was that if the difference is greater than 3 hours, then input "Out of Sync" in the timeliness field. However, in the alternative case, enter "Synced" in the timeliness field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My latest log time is in the following format:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;2021-07-23 02:54:09&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be greatly appreciated!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jul 2021 18:49:44 GMT</pubDate>
    <dc:creator>shakSplunk</dc:creator>
    <dc:date>2021-07-22T18:49:44Z</dc:date>
    <item>
      <title>Difference between latest log time and system time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Difference-between-latest-log-time-and-system-time/m-p/560514#M92646</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I have one field that simply shows that latest timestamp of logs.&lt;/P&gt;&lt;P&gt;i) I was wondering how can I find the difference between the latest log time and the current system time?&lt;/P&gt;&lt;P&gt;ii) Then with that value I was hoping to check run a condition and print the condition to another field (e.g. timeliness). The condition I wanted to implemented was that if the difference is greater than 3 hours, then input "Out of Sync" in the timeliness field. However, in the alternative case, enter "Synced" in the timeliness field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My latest log time is in the following format:&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;2021-07-23 02:54:09&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help would be greatly appreciated!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 18:49:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Difference-between-latest-log-time-and-system-time/m-p/560514#M92646</guid>
      <dc:creator>shakSplunk</dc:creator>
      <dc:date>2021-07-22T18:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between latest log time and system time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Difference-between-latest-log-time-and-system-time/m-p/560520#M92647</link>
      <description>&lt;P&gt;The first step is to convert the latest log time into integer form so it can be compared to the current time.&amp;nbsp; Use the strptime function for that.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... | eval lastLogEpoch=strptime(lastLogTime, "%Y-%m-%d %H:%M:%S")
| eval status=if(lastLogEpoch &amp;gt; relative_time(now(), "-3h"), "Synced", "Out of Sync")&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 22 Jul 2021 19:53:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Difference-between-latest-log-time-and-system-time/m-p/560520#M92647</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-07-22T19:53:05Z</dc:date>
    </item>
  </channel>
</rss>

