<?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 What's the output of the following eval and now() function query? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441027#M125326</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;Could you please help me here in confirming what would be the output of the below eval command?&lt;/P&gt;

&lt;P&gt;"eval age = (now() - _time )"&lt;/P&gt;

&lt;P&gt;Would the output be in minutes or seconds?&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;</description>
    <pubDate>Fri, 31 Aug 2018 16:21:17 GMT</pubDate>
    <dc:creator>bishtk</dc:creator>
    <dc:date>2018-08-31T16:21:17Z</dc:date>
    <item>
      <title>What's the output of the following eval and now() function query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441027#M125326</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;Could you please help me here in confirming what would be the output of the below eval command?&lt;/P&gt;

&lt;P&gt;"eval age = (now() - _time )"&lt;/P&gt;

&lt;P&gt;Would the output be in minutes or seconds?&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 16:21:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441027#M125326</guid>
      <dc:creator>bishtk</dc:creator>
      <dc:date>2018-08-31T16:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: What's the output of the following eval and now() function query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441028#M125327</link>
      <description>&lt;P&gt;@kundanbisht,&lt;/P&gt;

&lt;P&gt;You will get a difference in second.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults  | eval age=now()-_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 16:42:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441028#M125327</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-08-31T16:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: What's the output of the following eval and now() function query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441029#M125328</link>
      <description>&lt;P&gt;Hi @kamlesh_vaghela, this query result always gives 0 as output. How to figure out if its in seconds or minutes?&lt;/P&gt;

&lt;P&gt;_time                         age&lt;BR /&gt;
2018-08-31 12:52:29 0&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 16:55:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441029#M125328</guid>
      <dc:creator>bishtk</dc:creator>
      <dc:date>2018-08-31T16:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: What's the output of the following eval and now() function query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441030#M125329</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5713i4C34BDE2743D45F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 16:55:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441030#M125329</guid>
      <dc:creator>bishtk</dc:creator>
      <dc:date>2018-08-31T16:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: What's the output of the following eval and now() function query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441031#M125330</link>
      <description>&lt;P&gt;@kundanbisht,&lt;/P&gt;

&lt;P&gt;Let me tell you what exactly happens here.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval age = (now() - _time )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;now() is a splunk function gives you current time in epoc format(Unix time, data eg =1535779569).epoc time will be in seconds.&lt;BR /&gt;
_time is your splunk indexing time (data eg=2018-09-01 07:26:09)&lt;BR /&gt;
your trying to minus epoc time from datetime format it's possible . &lt;BR /&gt;
 please find the sample example below. If your now and _time is same you will get zero at age field..&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
 | eval epoctime=now()+1800
 | eval age = epoctime-_time
 | eval age1 = now()-_time
 | eval epoc_to_Datetime_format=strftime(epoctime,"%Y-%m-%d %H:%M:%S")
 | eval Datetime_to_Epoc_format=round(strptime(strftime(_time,"%Y-%m-%d %H:%M:%S"),"%Y-%m-%d %H:%M:%S"),0)
 | table epoctime epoc_to_Datetime_format _time Datetime_to_Epoc_format age age1 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ...&lt;/P&gt;</description>
      <pubDate>Sat, 01 Sep 2018 06:22:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441031#M125330</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2018-09-01T06:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: What's the output of the following eval and now() function query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441032#M125331</link>
      <description>&lt;P&gt;@kundanbisht,&lt;BR /&gt;
My given search is just an example.&lt;/P&gt;

&lt;P&gt;Please try below for your data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index | eval age=now()-_time 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 01 Sep 2018 13:29:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441032#M125331</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-09-01T13:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: What's the output of the following eval and now() function query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441033#M125332</link>
      <description>&lt;P&gt;Thank you @kamlesh_vaghela. Yes verified with the local data now. Its in seconds &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Sep 2018 07:49:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441033#M125332</guid>
      <dc:creator>bishtk</dc:creator>
      <dc:date>2018-09-03T07:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: What's the output of the following eval and now() function query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441034#M125333</link>
      <description>&lt;P&gt;@kundanbisht,&lt;/P&gt;

&lt;P&gt;Do you got your expected answers from above points ..&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 05:34:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-the-output-of-the-following-eval-and-now-function-query/m-p/441034#M125333</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2018-09-04T05:34:06Z</dc:date>
    </item>
  </channel>
</rss>

