<?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 determine and compare current time? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-determine-and-compare-current-time/m-p/616647#M214311</link>
    <description>&lt;P&gt;Friends, tell me how to be in the next task.&lt;BR /&gt;I have an alert time every two minutes.&lt;BR /&gt;I need to use this time, apparently something like this: now();&lt;BR /&gt;Next, I need to get the difference between the now() time and the time the last message (t). Let's call the difference between now() and t (t-now);&lt;BR /&gt;Enter the variable "interval" (inter), the value of which is 30 seconds;&lt;BR /&gt;Then, compare t-now and inter.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Oct 2022 13:59:14 GMT</pubDate>
    <dc:creator>metylkinandrey</dc:creator>
    <dc:date>2022-10-11T13:59:14Z</dc:date>
    <item>
      <title>How to determine and compare current time?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-determine-and-compare-current-time/m-p/616647#M214311</link>
      <description>&lt;P&gt;Friends, tell me how to be in the next task.&lt;BR /&gt;I have an alert time every two minutes.&lt;BR /&gt;I need to use this time, apparently something like this: now();&lt;BR /&gt;Next, I need to get the difference between the now() time and the time the last message (t). Let's call the difference between now() and t (t-now);&lt;BR /&gt;Enter the variable "interval" (inter), the value of which is 30 seconds;&lt;BR /&gt;Then, compare t-now and inter.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 13:59:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-determine-and-compare-current-time/m-p/616647#M214311</guid>
      <dc:creator>metylkinandrey</dc:creator>
      <dc:date>2022-10-11T13:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and compare current time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-determine-and-compare-current-time/m-p/616650#M214312</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/248856"&gt;@metylkinandrey&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you have to use the eval command, something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| eval diff=now()-_time)
| where diff&amp;gt;30&lt;/LI-CODE&gt;&lt;P&gt;If you could share your search I could be more detailed.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 11:04:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-determine-and-compare-current-time/m-p/616650#M214312</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-10-11T11:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and compare current time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-determine-and-compare-current-time/m-p/616651#M214313</link>
      <description>&lt;P&gt;I'm not sure what you're after but maybe something like that.&lt;/P&gt;&lt;PRE&gt;index=test1 earliest=-1d@d&lt;BR /&gt;```Let's define now as the current timestamp```&lt;BR /&gt;| eval now=now()&lt;BR /&gt;```Now let's find when was the latest event in our base search```&lt;BR /&gt;| eventstats latest_time(index) AS latest_event_timestamp&lt;BR /&gt;```And finally calculate the interval```&lt;BR /&gt;| eval interval=now-latest_event_timestamp&lt;BR /&gt;```Since we only have one latest_event and one now we don't have to show all events; we could have done "stats latest_time values(now)" as well instead```&lt;BR /&gt;| stats values(now) values(latest_event_timestamp) values(interval)&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Oct 2022 11:09:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-determine-and-compare-current-time/m-p/616651#M214313</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-10-11T11:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Determine and compare current time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-determine-and-compare-current-time/m-p/616652#M214314</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;But searching this way is kinda pointless. You can as well do&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_search&amp;gt; latest=-30s&lt;/PRE&gt;&lt;P&gt;And it makes much more sense (unless it's done way further down the pipeline where it actually might make sens if the _time comes from some heavy processing; otherwise let Splunk take care of time-based limiting).&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2022 13:11:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-determine-and-compare-current-time/m-p/616652#M214314</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2022-10-11T13:11:38Z</dc:date>
    </item>
  </channel>
</rss>

