<?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 Can you search a lookup table without specifying a particular field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333526#M99192</link>
    <description>&lt;P&gt;Is something like this possible?  Basically a freetext search of a lookup table to return the associated rows?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup L_EC2InstanceDetails|search "127.0.0.1"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Apr 2017 19:07:31 GMT</pubDate>
    <dc:creator>Cuyose</dc:creator>
    <dc:date>2017-04-18T19:07:31Z</dc:date>
    <item>
      <title>Can you search a lookup table without specifying a particular field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333526#M99192</link>
      <description>&lt;P&gt;Is something like this possible?  Basically a freetext search of a lookup table to return the associated rows?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup L_EC2InstanceDetails|search "127.0.0.1"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Apr 2017 19:07:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333526#M99192</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2017-04-18T19:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can you search a lookup table without specifying a particular field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333527#M99193</link>
      <description>&lt;P&gt;Not directly but may be using this workaround. Basically create a fields which will combine values from all columns and then search your freetext string in that combined field to filter rows in lookup.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup L_EC2InstanceDetails | eval combined="" | foreach * [eval combined=if("&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"!="combined",combined."#".'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;',combined) ] | search combined=*127.0.0.1* | fields - combined
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Apr 2017 19:49:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333527#M99193</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-04-18T19:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can you search a lookup table without specifying a particular field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333528#M99194</link>
      <description>&lt;P&gt;Damn, thats slick, thank you much!  Crazy it takes that kind of work.  I was going under the assumption Splunk would treat the lookup as a pseudo index by default since its a csv.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 20:17:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333528#M99194</guid>
      <dc:creator>Cuyose</dc:creator>
      <dc:date>2017-04-18T20:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Can you search a lookup table without specifying a particular field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333529#M99195</link>
      <description>&lt;P&gt;Splunk treats lookups as static tables and not raw events, that's why the freetext search that you do for events with _raw fields would not work. &lt;/P&gt;

&lt;P&gt;Another approach (similar) would be this (without combining so memory usage should be lower for this version)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|inputlookup L_EC2InstanceDetails 
| eval keeprow="N" 
| foreach * [eval keeprow=if(match('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;',"127\.0\.0\.1"),"Y",keeprow) ] 
| where keeprow="Y" | fields - keeprow
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Apr 2017 20:25:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333529#M99195</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-04-18T20:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can you search a lookup table without specifying a particular field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333530#M99196</link>
      <description>&lt;P&gt;Your response is incredibly helpful.  I have a very similar problem, with a twist.  I have several lookup tables with thousands of rows that I have presented to users in a tabbed dashboard.  &lt;/P&gt;

&lt;P&gt;Need to add a "search" button in the dashboard so that by default the page returns everything, and optionally a user can search for a keyword.  Using your example, how can I use search for everything, vice single keyword:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup ArcSight_Zone_Data_subnets.csv 
| eval keeprow="N"
| foreach * [eval keeprow=if(match('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;',"(noDNS)"),"Y",keeprow) ]
| where keeprow="Y" | fields - keeprow
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Wildcard (attempt, but fails)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup ArcSight_Zone_Data_subnets.csv 
| eval keeprow="N"
| foreach * [eval keeprow=if(match('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;',"(*)"),"Y",keeprow) ]
| where keeprow="Y" | fields - keeprow
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The parentheses around "(noDNS)" are necessary due to the inclusion of a dashboard search "token"&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 13:42:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333530#M99196</guid>
      <dc:creator>tlmayes</dc:creator>
      <dc:date>2017-08-09T13:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can you search a lookup table without specifying a particular field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333531#M99197</link>
      <description>&lt;P&gt;@tlmayes - I edited your comment to mark the code and restored the deleted &lt;CODE&gt;&amp;lt;FIELD&amp;gt;&lt;/CODE&gt; code -- use the 101 010 button or indent four spaces or mark with grave accents (`) before and after the code snippet, and that will keep the web from deleting stuff.&lt;/P&gt;

&lt;P&gt;For this use case, you can just calculate the &lt;CODE&gt;match&lt;/CODE&gt; mask in a line before the &lt;CODE&gt;foreach&lt;/CODE&gt;, then pass it in.  That would look something like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval keeprow="N"
 | eval mymatch=if(isnull(somefield),".",somefield)
| foreach * [eval keeprow=if(match('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;',"$somefield$"),"Y",keeprow) ]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Notes -&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;Remember that &lt;CODE&gt;match&lt;/CODE&gt; only has to match a single chunk of a field, not the entire field, so &lt;CODE&gt;"."&lt;/CODE&gt; is enough.  &lt;CODE&gt;"*"&lt;/CODE&gt; would &lt;STRONG&gt;only&lt;/STRONG&gt; match a single asterisk, so it's probably not what you want.  &lt;/P&gt;

&lt;P&gt;Parenthesis have a special grouping (and/or capturing) function in a &lt;CODE&gt;regex&lt;/CODE&gt;.  They didn't hurt anything in that example, but they didn't help anything either.&lt;/P&gt;

&lt;P&gt;If you are matching IP addresses, then compare the &lt;CODE&gt;cidrmatch&lt;/CODE&gt; function to see if it would help.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 13:59:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333531#M99197</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-08-09T13:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can you search a lookup table without specifying a particular field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333532#M99198</link>
      <description>&lt;P&gt;Hmm... not seeing the forest.  Are you suggesting in your code that "somefield" is the "fieldname" of choice?  If so, I cannot do this, since I need the ability to search All fields in the lookup table for a keyword.  My first query does not, but searches only on a known keyword, not a wildcard, and searches across ALL fields equally.  &lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 14:28:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-you-search-a-lookup-table-without-specifying-a-particular/m-p/333532#M99198</guid>
      <dc:creator>tlmayes</dc:creator>
      <dc:date>2017-08-09T14:28:11Z</dc:date>
    </item>
  </channel>
</rss>

