<?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: lookup multiple fields and tables in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/lookup-multiple-fields-and-tables/m-p/24512#M4530</link>
    <description>&lt;P&gt;I also have similar kind of problem, I want to match two fields (mailaddress and domain) to my inputlookup, but not able to get exact result.&lt;BR /&gt;
My lookup table have two different column for mailaddress and domain, I want to compare maliaddres field to lookup table mailaddress field and domain field to lookup table domain fields. And I have to match both fields in a single query... will you help me to make a query.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Sep 2019 13:22:09 GMT</pubDate>
    <dc:creator>prachi1501</dc:creator>
    <dc:date>2019-09-10T13:22:09Z</dc:date>
    <item>
      <title>lookup multiple fields and tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/lookup-multiple-fields-and-tables/m-p/24509#M4527</link>
      <description>&lt;P&gt;I have a two part question about lookup tables:&lt;/P&gt;

&lt;P&gt;Q1 - I have a 1 lookup table that has multiple fields.  Sometimes the fields could be populated and other times the fields could be empty.  For example&lt;/P&gt;

&lt;P&gt;col1, col2, col3&lt;BR /&gt;
d1,d2,d3&lt;BR /&gt;
,d2,d3&lt;BR /&gt;
d1,,d3&lt;/P&gt;

&lt;P&gt;Can you search a lookup with multiple fields?  Is there a way to search the data in a lookup regardless if the field is populated or not?&lt;/P&gt;

&lt;P&gt;I tried inputlookup:&lt;BR /&gt;
mysearch [| inputlookup mytable | fields field1,field2,field3]&lt;BR /&gt;
This brought 0 events when I am certain that there are events&lt;/P&gt;

&lt;P&gt;I also tried added a Flag column that eq true and running a lookup on table:&lt;BR /&gt;
 * | lookup mytable field1 fieldd2 field3 | search Flag=true&lt;BR /&gt;
This somewhat worked because it brought data that was in field3 but not in the other fields&lt;/P&gt;

&lt;P&gt;Q2 - I am populating 2 two different lookups.  Each lookup has 2 columns.  1 column is the data that I am searching for and other column is a flag.  I want to run a lookup on both tables and if the data in 1 lookup it will show the data in the output.  Can you search 2 lookups in 1 search command?&lt;/P&gt;

&lt;P&gt;I tried the following:&lt;BR /&gt;
mysearch | lookup mycsv.csv fields AS field1 | lookup mycsv2.csv fields AS field2 field3| search Flag=true.&lt;/P&gt;

&lt;P&gt;Can you search 2 lookups in 1 search command? &lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2011 22:54:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/lookup-multiple-fields-and-tables/m-p/24509#M4527</guid>
      <dc:creator>bsteelz93</dc:creator>
      <dc:date>2011-06-07T22:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: lookup multiple fields and tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/lookup-multiple-fields-and-tables/m-p/24510#M4528</link>
      <description>&lt;P&gt;Q2 first:  You can do 2 lookups in one search command, no problem.&lt;/P&gt;

&lt;P&gt;I don't think your syntax is quite right, though.  And if you fix that, maybe it will answer both questions for you.&lt;/P&gt;

&lt;P&gt;Although you can do it all at once, I recommend that you set up your lookups in 3 steps: first, go to the Splunk Manager, then choose Lookups -&amp;gt; Lookup Table Files -&amp;gt; New.  This is the place where you upload your .csv file to Splunk.  Give it a filename.csv that you will use in subsequent commands.&lt;/P&gt;

&lt;P&gt;Second, in the Splunk Manager, choose Lookups -&amp;gt; Lookup Definitions -&amp;gt; New.  This is the place where you actually name the lookup in Splunk - this name does not need to be the same as the filename.csv (and usually isn't).  I'll call it mylookupName in the example below.&lt;/P&gt;

&lt;P&gt;Step 3 - Make sure you know the names of the fields.  Your .csv file must have a first line that defines the column headings.  For example,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;col1,col2,col3,col4
100,102,203,good
500,400,300,bad
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It is helpful, but not required, if the column names match the field names in your search - but let's assume that they don't.  Your field names are field1, field2, field3 in your example above.&lt;/P&gt;

&lt;P&gt;Now, you can actually use the lookup in a search:&lt;/P&gt;

&lt;P&gt;mysearch | lookup mylookupName col1 as field1, col2 as field2, col3 as field3 OUTPUT col4&lt;/P&gt;

&lt;P&gt;For each event, if there is a row in the .csv file where all the input values matches, there will be a resulting field, col4, available for that event.&lt;/P&gt;

&lt;P&gt;Also look at this question: &lt;A href="http://splunk-base.splunk.com/answers/24816/can-i-chain-fields-together-between-two-different-lookups-csv-files"&gt;Can I chain fields together between two different lookups?&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Finally, from your search, I wonder if what you want can be accomplished without a lookup command at all... can you give more details?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2011 23:33:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/lookup-multiple-fields-and-tables/m-p/24510#M4528</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2011-06-07T23:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: lookup multiple fields and tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/lookup-multiple-fields-and-tables/m-p/24511#M4529</link>
      <description>&lt;P&gt;I also have similar kind of problem, I want to match two fields (mailaddress and domain) to my inputlookup, but not able to get exact result.&lt;BR /&gt;
My lookup table have two different column for mailaddress and domain, i have to compare maliaddres field to lookup mailaddress field and domain field to lookup domain fields. And I have to match both fields in a single query... will you help me to make a query.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 13:19:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/lookup-multiple-fields-and-tables/m-p/24511#M4529</guid>
      <dc:creator>prachi1501</dc:creator>
      <dc:date>2019-09-10T13:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: lookup multiple fields and tables</title>
      <link>https://community.splunk.com/t5/Splunk-Search/lookup-multiple-fields-and-tables/m-p/24512#M4530</link>
      <description>&lt;P&gt;I also have similar kind of problem, I want to match two fields (mailaddress and domain) to my inputlookup, but not able to get exact result.&lt;BR /&gt;
My lookup table have two different column for mailaddress and domain, I want to compare maliaddres field to lookup table mailaddress field and domain field to lookup table domain fields. And I have to match both fields in a single query... will you help me to make a query.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2019 13:22:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/lookup-multiple-fields-and-tables/m-p/24512#M4530</guid>
      <dc:creator>prachi1501</dc:creator>
      <dc:date>2019-09-10T13:22:09Z</dc:date>
    </item>
  </channel>
</rss>

