<?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 the Results of a Lookuptable in a Search Query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596431#M207638</link>
    <description>&lt;P&gt;Yup that was my issue!&lt;BR /&gt;Sorry for the Vagueness as Im not allowed to share to much.&lt;BR /&gt;Really appreciate your help and explanations, learned more than a few things just from the back and forth.&lt;/P&gt;</description>
    <pubDate>Wed, 04 May 2022 21:24:50 GMT</pubDate>
    <dc:creator>XJabs</dc:creator>
    <dc:date>2022-05-04T21:24:50Z</dc:date>
    <item>
      <title>How to use the Results of a Lookuptable in a Search Query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596414#M207627</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;So I have been working on this for a few days, looking at numerous Splunk responses but have yet to find something that works for my situation.&lt;BR /&gt;&lt;BR /&gt;So I have a large inventory of servers that I search through and currently use a general IN query in my searches but some querys have over 20 or so servers to search through and want to simplify it.&lt;BR /&gt;&lt;BR /&gt;So I am currently using something like this that works but can be exceedingly large depending on what servers I need to look up:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=myindex hosts IN (server1,server2,server3) &amp;lt;mysearchquery&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;So I had a bright idea of creating a lookup table to group the servers together.&lt;BR /&gt;The lookup table:&lt;BR /&gt;group,server&lt;BR /&gt;group1,server1&lt;BR /&gt;group1,server2&lt;BR /&gt;group1,server3&lt;BR /&gt;group2,server4&lt;BR /&gt;group2,server5&lt;BR /&gt;&lt;BR /&gt;I can get the desired list of servers by doing the following:&lt;BR /&gt;&lt;SPAN&gt;|inputlookup lookuptable.csv | search group=group1 | fields server&lt;BR /&gt;&lt;/SPAN&gt;This would return:&lt;BR /&gt;server1&lt;BR /&gt;server2&lt;BR /&gt;&lt;BR /&gt;but applying it to my search has proved a lot more difficult.&lt;BR /&gt;I think I was close with this one but have not quite figured it out yet:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=myindex &amp;lt;Search&amp;gt; [ |inputlookup lookuptable.csv | search group=group1 | fields server ]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Any suggestions would be greatly appreciated, or a link to similar posts for me to review.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 20:09:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596414#M207627</guid>
      <dc:creator>XJabs</dc:creator>
      <dc:date>2022-05-04T20:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Results of a Lookuptable in a Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596418#M207629</link>
      <description>&lt;P&gt;Have you tried something like this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex &amp;lt;Search&amp;gt; [ |inputlookup lookuptable.csv where group=group1 | fields server | format ]&lt;/LI-CODE&gt;&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;format&lt;/FONT&gt; command puts the results into a format for searching, like "&lt;FONT face="courier new,courier"&gt;server=server1 OR server=server2&lt;/FONT&gt;".&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 20:05:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596418#M207629</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-05-04T20:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Results of a Lookuptable in a Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596422#M207632</link>
      <description>&lt;P&gt;Unfortunately still didn't work.&lt;BR /&gt;Its interesting how format created it into the OR format as thats how I originally was searching before I discovered the IN command.&lt;BR /&gt;Still returned 0 records thought when I ran it as:&lt;/P&gt;&lt;PRE&gt;index=myindex &amp;lt;Search&amp;gt; [ |inputlookup lookuptable.csv where group=group1 | fields server | format ]&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 May 2022 20:18:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596422#M207632</guid>
      <dc:creator>XJabs</dc:creator>
      <dc:date>2022-05-04T20:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Results of a Lookuptable in a Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596425#M207635</link>
      <description>&lt;P&gt;The &lt;FONT face="courier new,courier"&gt;IN&lt;/FONT&gt; operator is converted to a sequence of &lt;FONT face="courier new,courier"&gt;OR&lt;/FONT&gt;s by the optimizer.&lt;/P&gt;&lt;P&gt;Can you tell us more about &amp;lt;Search&amp;gt;?&amp;nbsp; I'm thinking the result of format may interacting with &amp;lt;Search&amp;gt; to create an unexpected query that returns no results.&amp;nbsp; If it helps, look in the Job Inspector, click on Search Job Properties, and look at the Normalized Search.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 20:34:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596425#M207635</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-05-04T20:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Results of a Lookuptable in a Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596428#M207636</link>
      <description>&lt;P&gt;Sure thing, its nothing complex, Im keeping it very vague while trouble shooting and just searching for error&lt;BR /&gt;This returns results:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex hosts IN (server1,server2,server3) error&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this is not returning anything:&lt;/P&gt;&lt;PRE&gt;index=myindex error [ |inputlookup lookuptable.csv where group=group1 | fields server | format ]&lt;/PRE&gt;&lt;P&gt;Im under the impression its not using the returned list of servers properly in its search?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;From the Job inspection:&lt;/P&gt;&lt;P&gt;The following messages were returned by the search subsystem:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;info :&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;[subsearch]: Successfully read lookup file ....&amp;lt;Location of lookupfile&amp;gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 04 May 2022 20:56:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596428#M207636</guid>
      <dc:creator>XJabs</dc:creator>
      <dc:date>2022-05-04T20:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Results of a Lookuptable in a Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596430#M207637</link>
      <description>&lt;P&gt;Ah, HA!&amp;nbsp; This is an easy trap to fall into with subsearches and I did it.&amp;nbsp; Vagueness in the question didn't help.&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The first search is looking for the host field to have one of several values.&amp;nbsp; However, the second search is looking for the &lt;STRONG&gt;server&lt;/STRONG&gt; field to have one of those values.&amp;nbsp; If the index uses host rather than server then no results will be found.&amp;nbsp; The solution is to put a &lt;FONT face="courier new,courier"&gt;rename&lt;/FONT&gt; command in&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex error [ |inputlookup lookuptable.csv where group=group1 | fields server | rename server as host | format ]&lt;/LI-CODE&gt;&lt;P&gt;the subsearch.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 21:15:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596430#M207637</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-05-04T21:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using the Results of a Lookuptable in a Search Query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596431#M207638</link>
      <description>&lt;P&gt;Yup that was my issue!&lt;BR /&gt;Sorry for the Vagueness as Im not allowed to share to much.&lt;BR /&gt;Really appreciate your help and explanations, learned more than a few things just from the back and forth.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 21:24:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-the-Results-of-a-Lookuptable-in-a-Search-Query/m-p/596431#M207638</guid>
      <dc:creator>XJabs</dc:creator>
      <dc:date>2022-05-04T21:24:50Z</dc:date>
    </item>
  </channel>
</rss>

