<?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 Search using automatic lookup field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-using-automatic-lookup-field/m-p/24723#M4585</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;
I am trying to search source=test.csv (including fieldA) with the attached lookup file.&lt;BR /&gt;
I define the automatic lookup like 'URL as fieldA OUTPUTNEW DomainGroup AS Domain4fieldA'.&lt;BR /&gt;
Then I search like 'source=test.csv (Domain4fieldA="G1" OR Domain4fieldA="G2") | eval Service=Domain4fieldA | fields fieldA,Service' &lt;/P&gt;

&lt;P&gt;I expect the search result.&lt;BR /&gt;
    Service="G1,G2" in case of fieldA="&lt;A href="http://www.google.co.jp"&gt;www.google.co.jp&lt;/A&gt;" and &lt;BR /&gt;
    Service="G2" in case of fieldA="&lt;A href="http://www.splunk.com"&gt;www.splunk.com&lt;/A&gt;"&lt;/P&gt;

&lt;P&gt;But I get ..&lt;BR /&gt;
    Service="G1,G2,G3" in case of fieldA="&lt;A href="http://www.google.co.jp"&gt;www.google.co.jp&lt;/A&gt;" and &lt;BR /&gt;
    Service="G2,G4" in case of fieldA="&lt;A href="http://www.splunk.com"&gt;www.splunk.com&lt;/A&gt;"&lt;/P&gt;

&lt;P&gt;How can I search to get the correct result ?&lt;BR /&gt;
Please notify.  &lt;/P&gt;

&lt;P&gt;"DomainGroup","URL"&lt;BR /&gt;
"G1","&lt;A href="http://www.google.co.jp"&gt;www.google.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G1","&lt;A href="http://www.google.com"&gt;www.google.com&lt;/A&gt;"&lt;BR /&gt;
"G1","&lt;A href="http://www.yahoo.co.jp"&gt;www.yahoo.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G2","&lt;A href="http://www.google.co.jp"&gt;www.google.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G2","&lt;A href="http://www.amazon.co.jp"&gt;www.amazon.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G2","&lt;A href="http://www.rakuten.co.jp"&gt;www.rakuten.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G2","&lt;A href="http://www.splunk.com"&gt;www.splunk.com&lt;/A&gt;"&lt;BR /&gt;
"G3","&lt;A href="http://www.microsoft.com"&gt;www.microsoft.com&lt;/A&gt;"&lt;BR /&gt;
"G3","&lt;A href="http://www.google.co.jp"&gt;www.google.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G4","&lt;A href="http://www.splunk.com"&gt;www.splunk.com&lt;/A&gt;"&lt;BR /&gt;
"G4","&lt;A href="http://www.apple.com"&gt;www.apple.com&lt;/A&gt;"&lt;/P&gt;</description>
    <pubDate>Fri, 08 Feb 2013 04:55:59 GMT</pubDate>
    <dc:creator>satoto4</dc:creator>
    <dc:date>2013-02-08T04:55:59Z</dc:date>
    <item>
      <title>Search using automatic lookup field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-using-automatic-lookup-field/m-p/24723#M4585</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
I am trying to search source=test.csv (including fieldA) with the attached lookup file.&lt;BR /&gt;
I define the automatic lookup like 'URL as fieldA OUTPUTNEW DomainGroup AS Domain4fieldA'.&lt;BR /&gt;
Then I search like 'source=test.csv (Domain4fieldA="G1" OR Domain4fieldA="G2") | eval Service=Domain4fieldA | fields fieldA,Service' &lt;/P&gt;

&lt;P&gt;I expect the search result.&lt;BR /&gt;
    Service="G1,G2" in case of fieldA="&lt;A href="http://www.google.co.jp"&gt;www.google.co.jp&lt;/A&gt;" and &lt;BR /&gt;
    Service="G2" in case of fieldA="&lt;A href="http://www.splunk.com"&gt;www.splunk.com&lt;/A&gt;"&lt;/P&gt;

&lt;P&gt;But I get ..&lt;BR /&gt;
    Service="G1,G2,G3" in case of fieldA="&lt;A href="http://www.google.co.jp"&gt;www.google.co.jp&lt;/A&gt;" and &lt;BR /&gt;
    Service="G2,G4" in case of fieldA="&lt;A href="http://www.splunk.com"&gt;www.splunk.com&lt;/A&gt;"&lt;/P&gt;

&lt;P&gt;How can I search to get the correct result ?&lt;BR /&gt;
Please notify.  &lt;/P&gt;

&lt;P&gt;"DomainGroup","URL"&lt;BR /&gt;
"G1","&lt;A href="http://www.google.co.jp"&gt;www.google.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G1","&lt;A href="http://www.google.com"&gt;www.google.com&lt;/A&gt;"&lt;BR /&gt;
"G1","&lt;A href="http://www.yahoo.co.jp"&gt;www.yahoo.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G2","&lt;A href="http://www.google.co.jp"&gt;www.google.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G2","&lt;A href="http://www.amazon.co.jp"&gt;www.amazon.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G2","&lt;A href="http://www.rakuten.co.jp"&gt;www.rakuten.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G2","&lt;A href="http://www.splunk.com"&gt;www.splunk.com&lt;/A&gt;"&lt;BR /&gt;
"G3","&lt;A href="http://www.microsoft.com"&gt;www.microsoft.com&lt;/A&gt;"&lt;BR /&gt;
"G3","&lt;A href="http://www.google.co.jp"&gt;www.google.co.jp&lt;/A&gt;"&lt;BR /&gt;
"G4","&lt;A href="http://www.splunk.com"&gt;www.splunk.com&lt;/A&gt;"&lt;BR /&gt;
"G4","&lt;A href="http://www.apple.com"&gt;www.apple.com&lt;/A&gt;"&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2013 04:55:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-using-automatic-lookup-field/m-p/24723#M4585</guid>
      <dc:creator>satoto4</dc:creator>
      <dc:date>2013-02-08T04:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Search using automatic lookup field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-using-automatic-lookup-field/m-p/24724#M4586</link>
      <description>&lt;P&gt;I understand your thinking, but here is what really happens&lt;/P&gt;

&lt;P&gt;First, Splunk identifies all the events in the index that match your criteria. These events have various fieldA values. Let's pretend that the first two events look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; fieldA=www.google.co.jp fieldB=other_data a message here
 fieldA=www.splunk.com fieldB=something_else  a different message here
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Second, Splunk performs the lookup (it can't complete the search until it gets the values for &lt;CODE&gt;Domain4fieldA&lt;/CODE&gt;). When Splunk does the lookup, it finds ALL of the matching values and adds them to the events as a multi-valued field. This effectively does this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; fieldA=www.google.co.jp fieldB=other_data a message here Domain4fieldA=G1,G2,G3
 fieldA=www.splunk.com fieldB=something_else  a different message here Domain4fieldA=G2,G4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Third, Splunk determines which events now match your criteria - they have a value of either G1 or G2 in the Domain4fieldA. Both events qualify. Note that this does NOT eliminate the non-matching values of &lt;CODE&gt;Domain4fieldA&lt;/CODE&gt;. It only eliminates &lt;EM&gt;events&lt;/EM&gt; that don't have a matching value for &lt;CODE&gt;Domain4fieldA&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;Finally, the &lt;CODE&gt;eval&lt;/CODE&gt; and &lt;CODE&gt;table&lt;/CODE&gt; commands are processed as usual.&lt;/P&gt;

&lt;P&gt;If you don't want to see the other values in the multi-valued field, you will need to remove them. Try this command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=test.csv (Domain4fieldA="G1" OR Domain4fieldA="G2") 
| eval Service==mvfilter(match(Domain4fieldA, "G1") OR match(Domain4fieldA, "G2")) 
| fields fieldA,Service
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Feb 2013 07:40:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-using-automatic-lookup-field/m-p/24724#M4586</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-02-08T07:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Search using automatic lookup field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-using-automatic-lookup-field/m-p/24725#M4587</link>
      <description>&lt;P&gt;Thank you. I could get my expecting data.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2013 08:13:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-using-automatic-lookup-field/m-p/24725#M4587</guid>
      <dc:creator>satoto4</dc:creator>
      <dc:date>2013-02-08T08:13:48Z</dc:date>
    </item>
  </channel>
</rss>

