<?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 relative time question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/relative-time-question/m-p/571162#M199032</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;There is a tube Splunk video on finding new service interactive logins here:&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=bgIG2um_Hd0" target="_blank" rel="noopener"&gt;https://www.youtube.com/watch?v=bgIG2um_Hd0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The following line I just need a better understanding.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;| eval isOutlier=if (earliest &amp;gt;= relative_time(now), &amp;nbsp;"-1d@d"), 1, 0)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I understand this much. It is an outlier (1) if :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The earliest time of the first event is greater or equal to the time you ran the search&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"-1d@d" &amp;nbsp;--&amp;gt;&lt;/STRONG&gt;I am not understanding this part? Is it going back 1 day to find other matches that are also &lt;STRONG&gt;&amp;gt;= relative time (now)&lt;/STRONG&gt;? &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You would only get an Outlier if the times are the same . If you go back &lt;STRONG&gt;&lt;FONT color="#000000"&gt;"&lt;/FONT&gt;&lt;A href="mailto:1d@d" target="_blank" rel="noopener"&gt;&lt;FONT color="#000000"&gt;1d@d"&amp;nbsp;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/A&gt;&lt;/STRONG&gt;the earliest time of an event 1 day ago will never be equal to the the time you ran the event which is the relative _time(now). &amp;nbsp;How are the matches made when your going back &lt;STRONG&gt;1d@d&lt;/STRONG&gt;? I know I am thinking about this the wrong way. any assistance in understanding the logic would be greatly appreciated.&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;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Oct 2021 19:48:55 GMT</pubDate>
    <dc:creator>cbr654</dc:creator>
    <dc:date>2021-10-15T19:48:55Z</dc:date>
    <item>
      <title>relative time question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/relative-time-question/m-p/571162#M199032</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;There is a tube Splunk video on finding new service interactive logins here:&lt;BR /&gt;&lt;A href="https://www.youtube.com/watch?v=bgIG2um_Hd0" target="_blank" rel="noopener"&gt;https://www.youtube.com/watch?v=bgIG2um_Hd0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The following line I just need a better understanding.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;| eval isOutlier=if (earliest &amp;gt;= relative_time(now), &amp;nbsp;"-1d@d"), 1, 0)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I understand this much. It is an outlier (1) if :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The earliest time of the first event is greater or equal to the time you ran the search&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"-1d@d" &amp;nbsp;--&amp;gt;&lt;/STRONG&gt;I am not understanding this part? Is it going back 1 day to find other matches that are also &lt;STRONG&gt;&amp;gt;= relative time (now)&lt;/STRONG&gt;? &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You would only get an Outlier if the times are the same . If you go back &lt;STRONG&gt;&lt;FONT color="#000000"&gt;"&lt;/FONT&gt;&lt;A href="mailto:1d@d" target="_blank" rel="noopener"&gt;&lt;FONT color="#000000"&gt;1d@d"&amp;nbsp;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/A&gt;&lt;/STRONG&gt;the earliest time of an event 1 day ago will never be equal to the the time you ran the event which is the relative _time(now). &amp;nbsp;How are the matches made when your going back &lt;STRONG&gt;1d@d&lt;/STRONG&gt;? I know I am thinking about this the wrong way. any assistance in understanding the logic would be greatly appreciated.&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 19:48:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/relative-time-question/m-p/571162#M199032</guid>
      <dc:creator>cbr654</dc:creator>
      <dc:date>2021-10-15T19:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: relative time question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/relative-time-question/m-p/571163#M199033</link>
      <description>&lt;P&gt;Let's look at it from the inside out (a la Excel's Evaluate Formula feature).&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval isOutlier=if (earliest &amp;gt;= relative_time(now(),  "-1d@d"), 1, 0)&lt;/LI-CODE&gt;&lt;P&gt;expands to&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval isOutlier=if (earliest &amp;gt;= relative_time(2021-10-15T15:55:00, "-1d@d"), 1, 0)&lt;/LI-CODE&gt;&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;relative_time&lt;/FONT&gt; function works with epoch timestamps, but I'm using text timestamps for understandability.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The "-1d@d" argument to &lt;FONT face="courier new,courier"&gt;relative_time&lt;/FONT&gt; says to subtract 1 day from the first argument and round off to the beginning of the day.&amp;nbsp; That gives us&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval isOutlier=if (earliest &amp;gt;= 2021-10-14T00:00:00, 1, 0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Now we're left with a simple if-then-else.&amp;nbsp; We compare the value of the earliest field to the computed timestamp.&amp;nbsp; If earliest is greater than or equal to the timestamp then it's a newer event and isOutlier is set to 1; otherwise it is set to zero.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 20:02:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/relative-time-question/m-p/571163#M199033</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-10-15T20:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: relative time question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/relative-time-question/m-p/571226#M199040</link>
      <description>&lt;P&gt;thank you very much Rich. You explained it in a way that makes send to me&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 10:46:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/relative-time-question/m-p/571226#M199040</guid>
      <dc:creator>cbr654</dc:creator>
      <dc:date>2021-10-17T10:46:47Z</dc:date>
    </item>
  </channel>
</rss>

