<?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: Check lookup table for old/expired entries in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659770#M227780</link>
    <description>&lt;P&gt;Thanks for your reply, I appreciate it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I intentionally first got all &amp;lt;hosts&amp;gt;&amp;nbsp; from lookup table to reduce the search footprint.&amp;nbsp;&lt;BR /&gt;I get this error:&lt;BR /&gt;&lt;SPAN&gt;Error in 'lookup' command: Must specify one or more lookup fields.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Oct 2023 11:33:19 GMT</pubDate>
    <dc:creator>JTS911</dc:creator>
    <dc:date>2023-10-05T11:33:19Z</dc:date>
    <item>
      <title>Check lookup table for old/expired entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659416#M227680</link>
      <description>&lt;P&gt;Hi All&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I need to do some lookup table maintenance and would like to know which hosts are not being monitored but still in the lookup table&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My problem is I have &lt;STRONG&gt;host&lt;/STRONG&gt; fields that has an "*", I.E. host=saps*&amp;nbsp; that are valid and are being monitored&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my SPL&amp;nbsp;&lt;BR /&gt;-----------------------------------------------------&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| inputlookup host_lookup
| eval host=lower(host)
| join host type=left
[| metasearch (index=os_* OR index=perfmon_*)
| dedup host
| eval host=lower(host)
| eval eventTime=_time
| convert timeformat="%Y/%m/%d %H:%M:%S" ctime(eventTime) AS LastEventTime
| fields host eventTime LastEventTime index]

| eval Action=case(eventTime&amp;gt;200, "Keep Host", isnull(eventTime) , "Remove from Lookup")
| fields Action host LastEventTime &lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------------------&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 21:10:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659416#M227680</guid>
      <dc:creator>JTS911</dc:creator>
      <dc:date>2023-10-03T21:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Check lookup table for old/expired entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659471#M227699</link>
      <description>&lt;P&gt;Given that some lookup entries contain wildcard, it is reasonable to assume that your lookup is defined with match_type WILDCARD(host). &amp;nbsp;In the following I will make some simplifying assumptions because I do not know the significance of comparing eventTime or LastEventTime: All you want to compare is with events in your search window. &amp;nbsp;If your search window is past 7 days, I assume that you want to keep entries that one or more events match in the past week, and that you want to drop any table entries with zero match during this same period. &amp;nbsp;But if eventTime is important, I'm sure you can adapt the solution to meet your needs.&lt;/P&gt;&lt;P&gt;The key here is to utilize lookup; specifically, allow lookup to perform wildcard matches.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| metasearch (index=os_* OR index=perfmon_*)
| dedup host
| eval host=lower(host)
```| eval eventTime=_time
| convert timeformat="%Y/%m/%d %H:%M:%S" ctime(eventTime) AS LastEventTime
| fields host eventTime LastEventTime index
^^^ the above is not calculated or used ```
| lookup host_lookup output host AS matchhost
| append
    [inputlookup host_lookup
    | rename host AS tablehost]
| eventstats values(matchhost) as matchhost
| eval Action = if(tablehost IN matchhost, "Keep Host", "Remove from Lookup")
| fields Action tablehost&lt;/LI-CODE&gt;&lt;P&gt;(Obviously you do not need to rename tablehost. &amp;nbsp;It just makes the intent obvious.) Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2023 17:51:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659471#M227699</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-03T17:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Check lookup table for old/expired entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659770#M227780</link>
      <description>&lt;P&gt;Thanks for your reply, I appreciate it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I intentionally first got all &amp;lt;hosts&amp;gt;&amp;nbsp; from lookup table to reduce the search footprint.&amp;nbsp;&lt;BR /&gt;I get this error:&lt;BR /&gt;&lt;SPAN&gt;Error in 'lookup' command: Must specify one or more lookup fields.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 11:33:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659770#M227780</guid>
      <dc:creator>JTS911</dc:creator>
      <dc:date>2023-10-05T11:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Check lookup table for old/expired entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659822#M227795</link>
      <description>&lt;P&gt;That was my omission. (Syntax is explained in &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup" target="_blank" rel="noopener"&gt;lookup&lt;/A&gt;.)&amp;nbsp; I assume that you are trying to match "host" field in the following. (Also, you need to control letter case in the table to all-lower case.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| metasearch (index=os_* OR index=perfmon_*)
| dedup host
| eval host=lower(host)
```| eval eventTime=_time
| convert timeformat="%Y/%m/%d %H:%M:%S" ctime(eventTime) AS LastEventTime
| fields host eventTime LastEventTime index
^^^ the above is not calculated or used ```
| lookup host_lookup host output host AS matchhost
| append
    [inputlookup host_lookup
    | rename host AS tablehost]
| eventstats values(matchhost) as matchhost
| eval Action = if(tablehost IN matchhost, "Keep Host", "Remove from Lookup")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 17:06:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659822#M227795</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-10-05T17:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Check lookup table for old/expired entries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659960#M227834</link>
      <description>&lt;P&gt;Thank you for your reply&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 10:25:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Check-lookup-table-for-old-expired-entries/m-p/659960#M227834</guid>
      <dc:creator>JTS911</dc:creator>
      <dc:date>2023-10-06T10:25:22Z</dc:date>
    </item>
  </channel>
</rss>

