<?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: Using Lookup tables to exclude timerange from search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110014#M28721</link>
    <description>&lt;P&gt;Martin, I found the root of the problem. My lookup file has dates for the entire year. When I do a relative lookup those dates aren't applicable. But, when using all time they are. Can I make some modifications to the search to account for this?&lt;/P&gt;</description>
    <pubDate>Fri, 28 Mar 2014 18:41:10 GMT</pubDate>
    <dc:creator>jedatt01</dc:creator>
    <dc:date>2014-03-28T18:41:10Z</dc:date>
    <item>
      <title>Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110002#M28709</link>
      <description>&lt;P&gt;I am collecting statistics from an application and am trying to find a way to exclude search results from statistics that occur during a predetermined yearly outage window. I've loaded the outage window details in a lookup table and was wondering how I could use the lookup command inline to exclude from my search results. Lookup table fields and example below.&lt;/P&gt;

&lt;P&gt;Date            Starttime   Endtime&lt;BR /&gt;
1/10/2014       3:00 AM     5:00 AM&lt;BR /&gt;
1/24/2014   3:00 AM     7:00 AM&lt;BR /&gt;
....................................&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2014 17:29:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110002#M28709</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-03-27T17:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110003#M28710</link>
      <description>&lt;P&gt;Try this workaround. I am not sure about great performance. Also, assumption here is that all Maintenance windows are on hour, no fraction of minutes allowed)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval MaintW=_time | bucket span=1h MaintW | where NOT [|inputlookup MaintWindows.csv | eval MainStart=strptime(Date." ".Starttime,"%m/%d/%Y %H:%M %p") | eval MainEnd=strptime(Date." ".Endtime,"%m/%d/%Y %H:%M %p")-3600 | eval temp=MainStart."#".MainEnd | table temp | eval temp=split(temp,"#") | mvexpand temp | rename temp as MaintW | eval MaintW=round(MaintW)]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Mar 2014 21:26:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110003#M28710</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-03-27T21:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110004#M28711</link>
      <description>&lt;P&gt;Assuming your lookup has epoch time fields &lt;CODE&gt;start&lt;/CODE&gt; and &lt;CODE&gt;end&lt;/CODE&gt;, you can do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | search [inputlookup maintenance_windows | eval search = "(_time &amp;lt; "+start+" OR _time &amp;gt; "+end+")" | fields search | mvcombine search | eval search = "(" + mvjoin(search, " ") + ")"] | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That builds a search filter looking like this appended to your base search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... ((_time &amp;lt; start1 OR _time &amp;gt; end1) (_time &amp;lt; start2 OR _time &amp;gt; end2) ...)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note: This needs to have its own second &lt;CODE&gt;search&lt;/CODE&gt; command to avoid contradictions with the time range.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Mar 2014 21:36:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110004#M28711</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-03-27T21:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110005#M28712</link>
      <description>&lt;P&gt;Are you saying if I was to convert all time values in my lookup to epoch using fields start and end this logic should work?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 11:22:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110005#M28712</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-03-28T11:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110006#M28713</link>
      <description>&lt;P&gt;Or you can add the conversion to epoch time within the subsearch itself.&lt;/P&gt;

&lt;P&gt;base search [inputlookup maintenance_windows  | eval start=strptime(Date." ".Starttime,"%m/%d/%Y %H:%M %p") | eval end=strptime(Date." ".Endtime,"%m/%d/%Y %H:%M %p")| eval search = "(_time &amp;lt; "+start+" OR _time &amp;gt; "+end+")" | fields search | mvcombine search | eval search = "(" + mvjoin(search, " ") + ")"]&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:15:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110006#M28713</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T16:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110007#M28714</link>
      <description>&lt;P&gt;Looks like it's not happy with the where NOT, Splunk says its not supported. I'm on Splunk 6&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 14:14:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110007#M28714</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-03-28T14:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110008#M28715</link>
      <description>&lt;P&gt;Ok, almost there. That worked for all time, but does not work if i'm using a relative time (ex. Month to date) is there any way around that?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 14:24:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110008#M28715</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-03-28T14:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110009#M28716</link>
      <description>&lt;P&gt;In my head it should work for any time range already. Could you post the search filter produced by the subsearch for the non-working example? (See the job inspector's debug output at the top)&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 15:25:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110009#M28716</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-03-28T15:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110010#M28717</link>
      <description>&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/search_2.png" alt="alt text" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 16:14:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110010#M28717</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-03-28T16:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110011#M28718</link>
      <description>&lt;P&gt;The time filter generated by the subsearch looks okay.&lt;/P&gt;

&lt;P&gt;Did you expect the search peer &lt;CODE&gt;LOUMON09&lt;/CODE&gt; to fail? If not, investigate that.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 16:30:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110011#M28718</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-03-28T16:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110012#M28719</link>
      <description>&lt;P&gt;This is a single server splunk deployment. Not sure what I can check&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 16:38:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110012#M28719</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-03-28T16:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110013#M28720</link>
      <description>&lt;P&gt;Ah... that appears to be the core issue then. To narrow down the cause, let's simplify the search: Replace the subsearch with its output, from double opening to double closing parenthesis inclusive. If that search still fails to start, remove three quarters of the OR'd time filters. If that still fails, remove all but one time filter... and so on.&lt;/P&gt;

&lt;P&gt;Additionally, check for errors in the &lt;CODE&gt;_internal&lt;/CODE&gt; index at the time of search failure.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 16:50:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110013#M28720</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-03-28T16:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110014#M28721</link>
      <description>&lt;P&gt;Martin, I found the root of the problem. My lookup file has dates for the entire year. When I do a relative lookup those dates aren't applicable. But, when using all time they are. Can I make some modifications to the search to account for this?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 18:41:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110014#M28721</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-03-28T18:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110015#M28722</link>
      <description>&lt;P&gt;I don't think I understand what you're saying.&lt;/P&gt;

&lt;P&gt;What do you mean by "relative lookup"? &lt;CODE&gt;inputlookup&lt;/CODE&gt; shouldn't care about the timerange of the search.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 18:53:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110015#M28722</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-03-28T18:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110016#M28723</link>
      <description>&lt;P&gt;Let me try to rephrase. My lookup table has dates and times that span from Jan 2014 through Dec 2014. When I search with the all time range results come up properly. When I search a relative time range (Month to date) it says no results are displayed. I removed dates from my lookup table that were outside of  my month to date range and ran the search again and it was successful. So, I have concluded that the search will not complete if the lookup table is referencing dates/times that are outside of my search time.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 19:43:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110016#M28723</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-03-28T19:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110017#M28724</link>
      <description>&lt;P&gt;Ah! *bonks forehead on table*&lt;/P&gt;

&lt;P&gt;Of course... give me a second.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 19:57:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110017#M28724</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-03-28T19:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110018#M28725</link>
      <description>&lt;P&gt;All-right, got it. The trouble is - Splunk is trying to be too smart for its own good &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;When specifying the times outside the regular time range, it tries to fiddle with the time range resulting in an error like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;03-28-2014 21:23:52.306 ERROR ProviderQueue - Error while creating result provider: Error in 'litsearch' command: Unable to parse the search: Invalid time bounds in search: start=1395961200 &amp;gt; end=1395860091.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This can be solved by moving the filter outside of the first &lt;CODE&gt;search&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;old: base search [subsearch] | ...
new: base search | search [subsearch] | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Mar 2014 20:25:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110018#M28725</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-03-28T20:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110019#M28726</link>
      <description>&lt;P&gt;It works! thanks for hanging in there with me&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 21:02:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110019#M28726</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2014-03-28T21:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110020#M28727</link>
      <description>&lt;P&gt;@martin_mueller, is there any way to make it work by keeping the earliest/latest time bounds in the base search?  My base search is way too large unless I can get the multiple earliest/latest commands working in it.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Aug 2014 19:26:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110020#M28727</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2014-08-05T19:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using Lookup tables to exclude timerange from search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110021#M28728</link>
      <description>&lt;P&gt;@martin_mueller Awesome solution! Just what I was looking for. Thank you so much.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2019 05:14:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-Lookup-tables-to-exclude-timerange-from-search/m-p/110021#M28728</guid>
      <dc:creator>sansay</dc:creator>
      <dc:date>2019-04-22T05:14:01Z</dc:date>
    </item>
  </channel>
</rss>

