<?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 Search with Time Using a Lookup? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-with-Time-Using-a-Lookup/m-p/634298#M220347</link>
    <description>&lt;P&gt;I have a lookup of hosts with a field Last_Scan_Datetime and the field values were formated using&amp;nbsp;&lt;EM&gt;strftime(_time, "%Y-%m-%d-%H.%M.%S") .&amp;nbsp;&lt;/EM&gt;How would I go upon searching for hosts that were scanned in the last 3 days?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Everything I've found regarding searching with time has involved searching the index.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Mar 2023 16:51:31 GMT</pubDate>
    <dc:creator>atebysandwich</dc:creator>
    <dc:date>2023-03-14T16:51:31Z</dc:date>
    <item>
      <title>Search with Time Using a Lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-with-Time-Using-a-Lookup/m-p/634298#M220347</link>
      <description>&lt;P&gt;I have a lookup of hosts with a field Last_Scan_Datetime and the field values were formated using&amp;nbsp;&lt;EM&gt;strftime(_time, "%Y-%m-%d-%H.%M.%S") .&amp;nbsp;&lt;/EM&gt;How would I go upon searching for hosts that were scanned in the last 3 days?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Everything I've found regarding searching with time has involved searching the index.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 16:51:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-with-Time-Using-a-Lookup/m-p/634298#M220347</guid>
      <dc:creator>atebysandwich</dc:creator>
      <dc:date>2023-03-14T16:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Search with Time Using a Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-with-Time-Using-a-Lookup/m-p/634310#M220351</link>
      <description>&lt;P&gt;Looking up times is not straightforward.&amp;nbsp; For the most part, lookups do exact string matches (except for wildcard and CIDR matching, if defined).&amp;nbsp; Timestamps are even trickier since Splunk can't do much with them in string format.&amp;nbsp; That means something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup mylookup.csv where Last_Scan_Datetime &amp;gt; someValue&lt;/LI-CODE&gt;&lt;P&gt;won't work.&amp;nbsp; You'd have to convert the timestamp to epoch form and then compare it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup mylookup.csv
| eval epoch = strptime(Last_Scan_Datetime, "%Y-%m-%d-%H:%M:%S")
| where epoch &amp;gt; relative_time(now(), "-3d")&lt;/LI-CODE&gt;&lt;P&gt;This assumes your use case works with the &lt;FONT face="courier new,courier"&gt;inputlookup&lt;/FONT&gt; command.&amp;nbsp; I know of no similar solution using &lt;FONT face="courier new,courier"&gt;lookup&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 17:22:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-with-Time-Using-a-Lookup/m-p/634310#M220351</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-03-13T17:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Search with Time Using a Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-with-Time-Using-a-Lookup/m-p/634339#M220360</link>
      <description>&lt;P&gt;You can make a time based lookup definition where you define the settings as&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bowesmana_0-1678753775497.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24292iFCB0FF5F272E56EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bowesmana_0-1678753775497.png" alt="bowesmana_0-1678753775497.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then when you search your events, assuming your host field is called host, you do&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| lookup your_lookup_definition host OUTPUT Last_Scan_Datetime as found_Last_Scan_Datetime
| where isnull(found_Last_Scan_Datetime)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which will return you all the hosts where the&amp;nbsp;Last_Scan_Datetime field is older than 3 days ago from the _time field in the event for that host&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 00:40:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-with-Time-Using-a-Lookup/m-p/634339#M220360</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-03-14T00:40:27Z</dc:date>
    </item>
  </channel>
</rss>

