<?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 last 7 days on an input lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/last-7-days-on-an-input-lookup/m-p/425036#M191075</link>
    <description>&lt;P&gt;I have the below query where i want all closed dates counted by the last 7 days but the below is not working&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup int_case | search  closeddate!=null
| where _time&amp;gt;=relative_time(now(),"-1w") AND _time&amp;lt;=now() | stats count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This brings back 0. When i remove the the where search i get all the results. I find that Splunk seems to hate input lookups and you have to hack all your searches to get it to work correctly. &lt;/P&gt;

&lt;P&gt;Any advice on how to do this is appreciated&lt;/P&gt;</description>
    <pubDate>Fri, 02 Aug 2019 07:22:32 GMT</pubDate>
    <dc:creator>Sfry1981</dc:creator>
    <dc:date>2019-08-02T07:22:32Z</dc:date>
    <item>
      <title>last 7 days on an input lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/last-7-days-on-an-input-lookup/m-p/425036#M191075</link>
      <description>&lt;P&gt;I have the below query where i want all closed dates counted by the last 7 days but the below is not working&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup int_case | search  closeddate!=null
| where _time&amp;gt;=relative_time(now(),"-1w") AND _time&amp;lt;=now() | stats count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This brings back 0. When i remove the the where search i get all the results. I find that Splunk seems to hate input lookups and you have to hack all your searches to get it to work correctly. &lt;/P&gt;

&lt;P&gt;Any advice on how to do this is appreciated&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 07:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/last-7-days-on-an-input-lookup/m-p/425036#M191075</guid>
      <dc:creator>Sfry1981</dc:creator>
      <dc:date>2019-08-02T07:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: last 7 days on an input lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/last-7-days-on-an-input-lookup/m-p/425037#M191076</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;The data that is stored as lookup is not time dependent. So whenever you execute any search including lookups, it will result all matching results for the lookup irrespective of time.&lt;/P&gt;

&lt;P&gt;One way to limit lookup based on time is to store date &amp;amp; time stamp as a column while creating lookup.&lt;/P&gt;

&lt;P&gt;If your &lt;CODE&gt;closeddate&lt;/CODE&gt; field is timestamp string, than it can be easily done by below query,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup int_case | search  closeddate!=null
| eval _time = strptime(closeddate, "time stamp format of closeddate")
| where _time&amp;gt;=relative_time(now(),"-1w") AND _time&amp;lt;=now() | stats count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;time stamp format example - "%Y-%m-%d %H:%M:%S"&lt;/P&gt;

&lt;P&gt;Please upvote and accept the answer if it helps.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 08:07:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/last-7-days-on-an-input-lookup/m-p/425037#M191076</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-08-02T08:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: last 7 days on an input lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/last-7-days-on-an-input-lookup/m-p/425038#M191077</link>
      <description>&lt;P&gt;Thanks @gaurav_maniar &lt;/P&gt;

&lt;P&gt;Worlds like a dream &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 08:12:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/last-7-days-on-an-input-lookup/m-p/425038#M191077</guid>
      <dc:creator>Sfry1981</dc:creator>
      <dc:date>2019-08-02T08:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: last 7 days on an input lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/last-7-days-on-an-input-lookup/m-p/425039#M191078</link>
      <description>&lt;P&gt;please upvote the answer as well.&lt;BR /&gt;
thanks&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 14:42:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/last-7-days-on-an-input-lookup/m-p/425039#M191078</guid>
      <dc:creator>gaurav_maniar</dc:creator>
      <dc:date>2019-08-07T14:42:35Z</dc:date>
    </item>
  </channel>
</rss>

