<?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: how to use string from lookup table in search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432969#M171672</link>
    <description>&lt;P&gt;Can you run this search and post the results for just those three domains you have listed and post the results?  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup domain.csv
| eval hostname=domain
| table hostname
| format
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It should return results that look like this: &lt;CODE&gt;( ( hostname="yyy.us" ) OR ( hostname="yyy.at" ) OR ( hostname="yyy.ae" ) )&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I got this to work with a run anywhere example using the data you provided.  Here's the query that shows your main query and the results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1
| eval _raw="10.154.248.238 - - [03/May/2019:06:49:35.367 -0500] GET /xxx/rest/services/public/abc?ERROR_CODE=0x00000000&amp;amp;ERROR_TEXT=BA0521I%20%20%20Successful%20completion&amp;amp;HOSTNAME=www.yyy.us&amp;amp;AUTHNLEVEL= HTTP/1.1 307 - https://www.yyy.us/logout Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) userid=- sec=0 usec=13508 fwd=,- route=route0"
| rex field=_raw "\[(?&amp;lt;timestamp&amp;gt;[^\]]+)"
| eval _time=strptime(timestamp, "%d/%b/%Y:%H:%M:%S.%3N%z")
| fields - timestamp
| eval hostname=mvindex(split(mvindex(split(_raw,"&amp;amp;HOSTNAME="),1),"&amp;amp;AUTHNLEVEL="),0)
| eval hostname=trim(replace(hostname,"www.",""))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Your results should look like this:&lt;BR /&gt;
_raw&lt;BR /&gt;
&lt;CODE&gt;10.154.248.238 - - [03/May/2019:06:49:35.367 -0500] GET /xxx/rest/services/public/abc?ERROR_CODE=0x00000000&amp;amp;ERROR_TEXT=BA0521I%20%20%20Successful%20completion&amp;amp;HOSTNAME=&lt;A href="http://www.yyy.us&amp;amp;AUTHNLEVEL=" target="_blank"&gt;www.yyy.us&amp;amp;AUTHNLEVEL=&lt;/A&gt; HTTP/1.1 307 - &lt;A href="https://www.yyy.us/logout" target="_blank"&gt;https://www.yyy.us/logout&lt;/A&gt; Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) userid=- sec=0 usec=13508 fwd=,- route=route0&lt;/CODE&gt;&lt;BR /&gt;
_time&lt;BR /&gt;
&lt;CODE&gt;2019-05-03 07:49:35.367&lt;/CODE&gt;&lt;BR /&gt;
hostname&lt;BR /&gt;
&lt;CODE&gt;yyy.us&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This run anywhere query mimics your lookup file and produces the results I would expect with the format command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1
| fields - _time
| eval domain="yyy.us~yyy.at~yyy.ae"
| makemv domain delim="~"
| mvexpand domain
| eval hostname=domain
| table hostname
| format
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You should see this under the search header: &lt;CODE&gt;( ( hostname="yyy.us" ) OR ( hostname="yyy.at" ) OR ( hostname="yyy.ae" ) )&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Combining them into a single search that will return any hostname that exists in that lookup:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1
| eval _raw="10.154.248.238 - - [03/May/2019:06:49:35.367 -0500] GET /xxx/rest/services/public/abc?ERROR_CODE=0x00000000&amp;amp;ERROR_TEXT=BA0521I%20%20%20Successful%20completion&amp;amp;HOSTNAME=www.yyy.us&amp;amp;AUTHNLEVEL= HTTP/1.1 307 - https://www.yyy.us/logout Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) userid=- sec=0 usec=13508 fwd=,- route=route0"
| rex field=_raw "\[(?&amp;lt;timestamp&amp;gt;[^\]]+)"
| eval _time=strptime(timestamp, "%d/%b/%Y:%H:%M:%S.%3N%z")
| fields - timestamp
| eval hostname=mvindex(split(mvindex(split(_raw,"&amp;amp;HOSTNAME="),1),"&amp;amp;AUTHNLEVEL="),0)
| eval hostname=trim(replace(hostname,"www.",""))
| search [| makeresults count=1
| fields - _time
| eval domain="yyy.us~yyy.at~yyy.ae"
| makemv domain delim="~"
| mvexpand domain
| eval hostname=domain
| table hostname
| format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can change the data after HOSTNAME=www to confirm that the filter is functioning with any three of the domains in the lookup as well as see it return no results if you make it something not in that lookup.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 00:25:13 GMT</pubDate>
    <dc:creator>dmarling</dc:creator>
    <dc:date>2020-09-30T00:25:13Z</dc:date>
    <item>
      <title>how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432953#M171656</link>
      <description>&lt;P&gt;Hi there,&lt;BR /&gt;
I want to build a query with strings from the lookup table. I have the list of domains in the look up table that I want to use in the query to match as hostname&lt;BR /&gt;
&lt;STRONG&gt;base query:&lt;/STRONG&gt;&lt;BR /&gt;
&lt;CODE&gt;index=* host=1 OR host=1 "HTTP/1.1 30*" "abc" | eval hostname=mvindex(split(....))&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;lookup&lt;/STRONG&gt; &lt;BR /&gt;
&lt;CODE&gt;[| inputlookup domain.csv &lt;BR /&gt;
  | fields domain&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Domain in the lookup are the hostname in the base search.&lt;BR /&gt;
Can someone advise on this, please?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 10:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432953#M171656</guid>
      <dc:creator>afulamba</dc:creator>
      <dc:date>2019-04-26T10:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432954#M171657</link>
      <description>&lt;P&gt;Your lookup should look like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* host=1 OR host=1 "HTTP/1.1 30*" "abc" | eval hostname=mvindex(split(....))
| lookup domain.csv domain AS host OUTPUT &amp;lt;Column name in csv you want to output&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So if you had another column name that was titled URL, your lookup would look like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=* host=1 OR host=1 "HTTP/1.1 30*" "abc" | eval hostname=mvindex(split(....))
| lookup domain.csv domain AS host OUTPUT URL
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Apr 2019 10:48:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432954#M171657</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2019-04-26T10:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432955#M171658</link>
      <description>&lt;P&gt;Thanks for the input. Actually I have single column look up table with column name 'domain', no other column for host. &lt;BR /&gt;
To avoid the list of domains in the base query that looks ugly, I want to keep the fix list of domains in the table and I can add new domains as and when required in the table. However, the hostname derived from the logs in the base query can be any value based on the client domain. I want to filter the requests in the apache logs which have the hostname exist in lookup table.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 11:33:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432955#M171658</guid>
      <dc:creator>afulamba</dc:creator>
      <dc:date>2019-04-26T11:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432956#M171659</link>
      <description>&lt;P&gt;I'm not sure I understand. Your lookup table only has a single column? Lookups are used to enrich your data in Splunk, here's an example of how it works &lt;/P&gt;

&lt;P&gt;You have a lookup with 2 columns, first column is labeled &lt;CODE&gt;host&lt;/CODE&gt; and second column is labeled &lt;CODE&gt;domain&lt;/CODE&gt;. There is no domain fields in Splunk and you want to map the domain to each host. Since your hostnames in Splunk match the hostnames in the lookup, you can link those hostnames together to map the domain field. The logic looks like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup domain.csv &amp;lt;field that matches your lookup to date&amp;gt; OUTPUT &amp;lt;field that you have in lookup but not logs&amp;gt;

| lookup domain.csv host OUTPUT domain
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Apr 2019 12:53:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432956#M171659</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2019-04-26T12:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432957#M171660</link>
      <description>&lt;P&gt;May be the labels I used are confusing. &lt;BR /&gt;
&lt;STRONG&gt;base query example:&lt;/STRONG&gt; &lt;BR /&gt;
&lt;CODE&gt;index=* host=1 OR host=1 "HTTP/1.1 30*" "abc" | eval hostname=mvindex(split(....))&lt;/CODE&gt;&lt;BR /&gt;
Here the derived hostname value could be abc.com, def.com etc.&lt;BR /&gt;
In the look up table for domain column I have listed abc.com, def.com etc.&lt;BR /&gt;
So my need is that the search should return the result if the derived hostname matches with domain in the lookup. To follow your approach I would need to add another column in the lookup something relevant to it otherwise. Please suggest.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 13:43:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432957#M171660</guid>
      <dc:creator>afulamba</dc:creator>
      <dc:date>2019-04-26T13:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432958#M171661</link>
      <description>&lt;P&gt;So you want to iterate through a lookup table and see what matches from the lookup and whats in Splunk?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 14:54:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432958#M171661</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2019-04-26T14:54:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432959#M171662</link>
      <description>&lt;P&gt;Thats correct. whatever derived as hostname from logs, match it with domain in the lookup table.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 15:56:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432959#M171662</guid>
      <dc:creator>afulamba</dc:creator>
      <dc:date>2019-04-26T15:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432960#M171663</link>
      <description>&lt;P&gt;Any more suggesstions please?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2019 07:09:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432960#M171663</guid>
      <dc:creator>afulamba</dc:creator>
      <dc:date>2019-04-30T07:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432961#M171664</link>
      <description>&lt;P&gt;Try something like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup domain.csv
| rename domain AS host
| join host
    [| search index=* host=1 OR host=1 "HTTP/1.1 30*" "abc" | stats count by host | fields + host ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Apr 2019 15:48:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432961#M171664</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2019-04-30T15:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432962#M171665</link>
      <description>&lt;P&gt;I tried both as suggested below but doesn't work as expected.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;This returns no result&lt;/STRONG&gt;&lt;BR /&gt;
&lt;CODE&gt;| inputlookup domain.csv&lt;BR /&gt;
 | rename domain AS hostname&lt;BR /&gt;
 | join hostname [| search&lt;BR /&gt;
index=web host=1 OR host=2  sourcetype="apache:access" "*HTTP/1.1 5*" "*abc*" &lt;BR /&gt;
| eval hostname=mvindex(split(mvindex(split(_raw,"xxxx="),1),"&amp;amp;yyyyy"),0) | stats count by hostname ]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;This returns result even the domain value is not in the lookup.&lt;/STRONG&gt;&lt;BR /&gt;
&lt;CODE&gt;[| inputlookup domain.csv | stats values(domain) as query ] &lt;BR /&gt;
 index=web host=1 OR host=2  sourcetype="apache:access" "*HTTP/1.1 5*" "*abc*" | eval hostname=mvindex(split(mvindex(split(_raw,"xxx"),1),"yyyyy"),0)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 08:35:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432962#M171665</guid>
      <dc:creator>afulamba</dc:creator>
      <dc:date>2019-05-02T08:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432963#M171666</link>
      <description>&lt;P&gt;This should return results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* host=1 OR host=1 "HTTP/1.1 30*" "abc" 
| eval hostname=mvindex(split(....)) 
| search 
    [| inputlookup domain.csv 
    | eval hostname=domain
    | table hostname 
    | format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You need to make the name of the field that contains the data you want match the name of the field it will be running that search against.  The format command will then format the results of the lookup into SPL that can be executed on a search line.&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 13:39:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432963#M171666</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2019-05-02T13:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432964#M171667</link>
      <description>&lt;P&gt;Why are you renaming it hostname? It has to join on a common field from the lookup to the events in Splunk. &lt;CODE&gt;host&lt;/CODE&gt; is the default field in Splunk. Keep it as &lt;CODE&gt;host&lt;/CODE&gt; and it will work&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 14:10:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432964#M171667</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2019-05-02T14:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432965#M171668</link>
      <description>&lt;P&gt;If I'm reading his original post correctly, the domain lookup file equates to the hostname eval he is extracting in his search, not the host that the access log originated from. &lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 14:16:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432965#M171668</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2019-05-02T14:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432966#M171669</link>
      <description>&lt;P&gt;If I run the these 2 subsearch separately, I see the hostname value return from first search also returns from the look up from the second search, however, when run the search together as above, it doesn't return the data. Did it work for anybody for such scenario?&lt;BR /&gt;
Thanks for the input.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 12:40:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432966#M171669</guid>
      <dc:creator>afulamba</dc:creator>
      <dc:date>2019-05-03T12:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432967#M171670</link>
      <description>&lt;P&gt;If could provide an example of the events that you are looking at (with any private information removed) form your main query and some examples of the events in your lookup file I can give you a more details query using a run anywhere example.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 12:43:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432967#M171670</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2019-05-03T12:43:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432968#M171671</link>
      <description>&lt;P&gt;Here is the sample log event and the lookup&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;First query for hostname from the logs&lt;/STRONG&gt;&lt;BR /&gt;
&lt;CODE&gt;index=web host=1 OR host=2  "*HTTP/1.1 3*" "*abc*" &lt;BR /&gt;
| eval hostname=mvindex(split(mvindex(split(_raw,"&amp;amp;HOSTNAME="),1),"&amp;amp;AUTHNLEVEL="),0) &lt;BR /&gt;
| eval hostname=trim(replace(hostname,"www.",""))&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;10.154.248.238 - - [03/May/2019:06:49:35.367 -0500] GET /xxx/rest/services/public/abc?ERROR_CODE=0x00000000&amp;amp;ERROR_TEXT=BA0521I%20%20%20Successful%20completion&amp;amp;HOSTNAME=www.yyy.us&amp;amp;AUTHNLEVEL= HTTP/1.1 307 - &lt;A href="https://www.yyy.us/logout" target="test_blank"&gt;https://www.yyy.us/logout&lt;/A&gt; Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) userid=- sec=0 usec=13508 fwd=,- route=route0&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Lookup table&lt;/STRONG&gt;&lt;BR /&gt;
&lt;CODE&gt;| inputlookup domain.csv&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;domain&lt;/STRONG&gt;&lt;BR /&gt;
&lt;STRONG&gt;yyy.us&lt;/STRONG&gt;&lt;BR /&gt;
yyy.at&lt;BR /&gt;
yyy.ae&lt;/P&gt;

&lt;P&gt;So in this example if I see &lt;STRONG&gt;yyy.us&lt;/STRONG&gt; in the both the result I am expecting this when I combine the query in one.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 13:07:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432968#M171671</guid>
      <dc:creator>afulamba</dc:creator>
      <dc:date>2019-05-03T13:07:34Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432969#M171672</link>
      <description>&lt;P&gt;Can you run this search and post the results for just those three domains you have listed and post the results?  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup domain.csv
| eval hostname=domain
| table hostname
| format
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It should return results that look like this: &lt;CODE&gt;( ( hostname="yyy.us" ) OR ( hostname="yyy.at" ) OR ( hostname="yyy.ae" ) )&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I got this to work with a run anywhere example using the data you provided.  Here's the query that shows your main query and the results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1
| eval _raw="10.154.248.238 - - [03/May/2019:06:49:35.367 -0500] GET /xxx/rest/services/public/abc?ERROR_CODE=0x00000000&amp;amp;ERROR_TEXT=BA0521I%20%20%20Successful%20completion&amp;amp;HOSTNAME=www.yyy.us&amp;amp;AUTHNLEVEL= HTTP/1.1 307 - https://www.yyy.us/logout Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) userid=- sec=0 usec=13508 fwd=,- route=route0"
| rex field=_raw "\[(?&amp;lt;timestamp&amp;gt;[^\]]+)"
| eval _time=strptime(timestamp, "%d/%b/%Y:%H:%M:%S.%3N%z")
| fields - timestamp
| eval hostname=mvindex(split(mvindex(split(_raw,"&amp;amp;HOSTNAME="),1),"&amp;amp;AUTHNLEVEL="),0)
| eval hostname=trim(replace(hostname,"www.",""))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Your results should look like this:&lt;BR /&gt;
_raw&lt;BR /&gt;
&lt;CODE&gt;10.154.248.238 - - [03/May/2019:06:49:35.367 -0500] GET /xxx/rest/services/public/abc?ERROR_CODE=0x00000000&amp;amp;ERROR_TEXT=BA0521I%20%20%20Successful%20completion&amp;amp;HOSTNAME=&lt;A href="http://www.yyy.us&amp;amp;AUTHNLEVEL=" target="_blank"&gt;www.yyy.us&amp;amp;AUTHNLEVEL=&lt;/A&gt; HTTP/1.1 307 - &lt;A href="https://www.yyy.us/logout" target="_blank"&gt;https://www.yyy.us/logout&lt;/A&gt; Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) userid=- sec=0 usec=13508 fwd=,- route=route0&lt;/CODE&gt;&lt;BR /&gt;
_time&lt;BR /&gt;
&lt;CODE&gt;2019-05-03 07:49:35.367&lt;/CODE&gt;&lt;BR /&gt;
hostname&lt;BR /&gt;
&lt;CODE&gt;yyy.us&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This run anywhere query mimics your lookup file and produces the results I would expect with the format command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1
| fields - _time
| eval domain="yyy.us~yyy.at~yyy.ae"
| makemv domain delim="~"
| mvexpand domain
| eval hostname=domain
| table hostname
| format
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You should see this under the search header: &lt;CODE&gt;( ( hostname="yyy.us" ) OR ( hostname="yyy.at" ) OR ( hostname="yyy.ae" ) )&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Combining them into a single search that will return any hostname that exists in that lookup:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=1
| eval _raw="10.154.248.238 - - [03/May/2019:06:49:35.367 -0500] GET /xxx/rest/services/public/abc?ERROR_CODE=0x00000000&amp;amp;ERROR_TEXT=BA0521I%20%20%20Successful%20completion&amp;amp;HOSTNAME=www.yyy.us&amp;amp;AUTHNLEVEL= HTTP/1.1 307 - https://www.yyy.us/logout Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0) userid=- sec=0 usec=13508 fwd=,- route=route0"
| rex field=_raw "\[(?&amp;lt;timestamp&amp;gt;[^\]]+)"
| eval _time=strptime(timestamp, "%d/%b/%Y:%H:%M:%S.%3N%z")
| fields - timestamp
| eval hostname=mvindex(split(mvindex(split(_raw,"&amp;amp;HOSTNAME="),1),"&amp;amp;AUTHNLEVEL="),0)
| eval hostname=trim(replace(hostname,"www.",""))
| search [| makeresults count=1
| fields - _time
| eval domain="yyy.us~yyy.at~yyy.ae"
| makemv domain delim="~"
| mvexpand domain
| eval hostname=domain
| table hostname
| format]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can change the data after HOSTNAME=www to confirm that the filter is functioning with any three of the domains in the lookup as well as see it return no results if you make it something not in that lookup.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:25:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432969#M171672</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2020-09-30T00:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432970#M171673</link>
      <description>&lt;P&gt;I had to change the field name in the lookup from sf-domain to whitelistdomain and it worked. It seems "-" in the field name was the culprit which was not evaluating the host name. I had not given the actual domain names and the actual lookup details for security reason. My bad, we could have identified the issue earlier otherwise.&lt;BR /&gt;
Thanks a lot for your help!!!!!!!&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 11:33:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432970#M171673</guid>
      <dc:creator>afulamba</dc:creator>
      <dc:date>2019-05-13T11:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432971#M171674</link>
      <description>&lt;P&gt;You're welcome!  Just as an FYI you can fix the hyphen causing the issue with either using a rename command with double quotes around the field name &lt;CODE&gt;| rename "sf-domain" as hostname&lt;/CODE&gt; or use a single quote around the field name when doing an eval &lt;CODE&gt;| eval hostname='sf-domain'&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 12:18:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432971#M171674</guid>
      <dc:creator>dmarling</dc:creator>
      <dc:date>2019-05-13T12:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to use string from lookup table in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432972#M171675</link>
      <description>&lt;P&gt;Yup, sure. Thanks for all your help.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 12:23:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-use-string-from-lookup-table-in-search/m-p/432972#M171675</guid>
      <dc:creator>afulamba</dc:creator>
      <dc:date>2019-05-13T12:23:10Z</dc:date>
    </item>
  </channel>
</rss>

