<?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 Re: Eval command to display results with X days before current date in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624527#M217121</link>
    <description>&lt;P&gt;Thank you for checking.&amp;nbsp; I was making a mistake in the strptime() command.&amp;nbsp; Had the time format mentioned incorrectly there.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;Manasa's response worked&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Dec 2022 10:50:51 GMT</pubDate>
    <dc:creator>neerajs_81</dc:creator>
    <dc:date>2022-12-16T10:50:51Z</dc:date>
    <item>
      <title>How to get eval command to display results with X days before current date?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624507#M217117</link>
      <description>&lt;P&gt;Hi All, i have a field "last_seen" which shows date in the below format .&amp;nbsp; &amp;nbsp; My requirement is to compare today's date against this last_seen date and show only those events which is 3 days before today's date&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;TABLE border="1" width="36.93970959595959%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="100%" height="25px"&gt;last_seen&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="100%" height="25px"&gt;&lt;SPAN&gt;2022-12-15T19:46:55Z&lt;/SPAN&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="100%" height="25px"&gt;&lt;SPAN&gt;2022-12-14T19:46:55Z&lt;/SPAN&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="100%" height="25px"&gt;&lt;SPAN&gt;2022-12-11T19:46:55Z&lt;/SPAN&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought of calculating first a field that shows me the date&amp;nbsp; &amp;nbsp;3 days before this last_seen value and then further doing a |where condition to show me the results.&amp;nbsp; I tried the below calculation&amp;nbsp; but deltaDays is&amp;nbsp; coming out empty as splunk shows it blank . So the formula of &lt;STRONG&gt;now()-last_seen&lt;/STRONG&gt; isn't working.&amp;nbsp; &amp;nbsp; Reference:&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Splunk-Search/Display-events-when-current-date-is-gt-30-days-from-expiration/m-p/249876" target="_blank" rel="noopener"&gt;https://community.splunk.com/t5/Splunk-Search/Display-events-when-current-date-is-gt-30-days-from-expiration/m-p/249876&lt;/A&gt;&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;
&lt;LI-CODE lang="markup"&gt;| eval deltaDays = (now() - last_seen)/86400 | where deltaDays &amp;gt;=3
| table last_seen deltaDays &lt;/LI-CODE&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;
&lt;P&gt;&lt;BR /&gt;Expected results ( given todays date is Dec 16).&amp;nbsp; Show results from 3 days before&lt;/P&gt;
&lt;TABLE border="1"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="182.016px" height="25px"&gt;last_seen&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="182.016px" height="25px"&gt;&lt;SPAN&gt;2022-12-11T19:46:55Z&lt;/SPAN&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 14:01:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624507#M217117</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-12-16T14:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Eval command to display results with X days before current date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624509#M217118</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229059"&gt;@neerajs_81&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;your approach is correct.&lt;/P&gt;&lt;P&gt;What's your question?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 07:19:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624509#M217118</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-12-16T07:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Eval command to display results with X days before current date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624526#M217120</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229059"&gt;@neerajs_81&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Try converting the last_seen into epoch format&lt;BR /&gt;|eval e_last_seen = strptime(last_seen,"%Y-%m-%dT%H:%M:%SZ")&lt;BR /&gt;&lt;BR /&gt;Later you can perform the calculations as you did&amp;nbsp;&lt;/P&gt;&lt;P&gt;| eval deltaDays = (now() - e_last_seen)/86400 | where deltaDays &amp;gt;=3&lt;BR /&gt;| table last_seen deltaDays&lt;/P&gt;&lt;P&gt;If this helps karma would be appreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;Manasa&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 10:39:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624526#M217120</guid>
      <dc:creator>Manasa_401</dc:creator>
      <dc:date>2022-12-16T10:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Eval command to display results with X days before current date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624527#M217121</link>
      <description>&lt;P&gt;Thank you for checking.&amp;nbsp; I was making a mistake in the strptime() command.&amp;nbsp; Had the time format mentioned incorrectly there.&amp;nbsp; &amp;nbsp;&lt;BR /&gt;Manasa's response worked&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 10:50:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624527#M217121</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-12-16T10:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Eval command to display results with X days before current date</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624528#M217122</link>
      <description>&lt;P&gt;THANK you&lt;/P&gt;</description>
      <pubDate>Fri, 16 Dec 2022 10:51:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-eval-command-to-display-results-with-X-days-before/m-p/624528#M217122</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2022-12-16T10:51:30Z</dc:date>
    </item>
  </channel>
</rss>

