<?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: Can I perform a lookup on 1 lookup field AS 2 existing fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213012#M62444</link>
    <description>&lt;P&gt;Well then your initial search with two lookups will never lookup any events from the second lookup either.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Feb 2016 07:41:30 GMT</pubDate>
    <dc:creator>jeffland</dc:creator>
    <dc:date>2016-02-23T07:41:30Z</dc:date>
    <item>
      <title>Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213002#M62434</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have two existing fields: &lt;STRONG&gt;mailto&lt;/STRONG&gt;, &lt;STRONG&gt;mailfrom&lt;/STRONG&gt;.&lt;BR /&gt;
I also have a lookup with 2 fields: &lt;STRONG&gt;Mail&lt;/STRONG&gt; and &lt;STRONG&gt;Country&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I would like to perform a lookup like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup mail_country Mail AS mailfrom , Mail AS mailto  OUTPUT Country  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this doesn't work... I need to perform 2 lookups:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup mail_country Mail AS mailfrom OUTPUT Country  | lookup mail_country Mail AS mailto  OUTPUTNEW Country  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I don't think it is efficient to perform 2 lookups like this...&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 10:09:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213002#M62434</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2016-02-19T10:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213003#M62435</link>
      <description>&lt;P&gt;Hi &lt;BR /&gt;
let try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |set union[search .................| lookup mail_country Mail AS mailfrom OUTPUT Country |fields Country][search ...............| lookup mail_country Mail AS mailto  OUTPUTNEW Country |fields Country]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2016 10:35:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213003#M62435</guid>
      <dc:creator>chimell</dc:creator>
      <dc:date>2016-02-19T10:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213004#M62436</link>
      <description>&lt;P&gt;I know it's not pretty, but you could do&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval mail_copy=Mail | lookup mail_country Mail AS mailfrom , mail_copy AS mailto  OUTPUT Country
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2016 12:34:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213004#M62436</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2016-02-19T12:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213005#M62437</link>
      <description>&lt;P&gt;It doesn't seem more efficient, as there is still two lookups&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 14:03:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213005#M62437</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2016-02-19T14:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213006#M62438</link>
      <description>&lt;P&gt;But the variable "Mail" doesn't exist before the lookup ..?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 14:04:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213006#M62438</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2016-02-19T14:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213007#M62439</link>
      <description>&lt;P&gt;Ah, sorry - I misunderstood your question.&lt;BR /&gt;
You could do the same you are doing with the two lookups like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval coalesced_mail=coalesce(mailfrom, mailto) | lookup mail_country Mail AS coalesced_mail OUTPUT Country
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Feb 2016 11:09:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213007#M62439</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2016-02-22T11:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213008#M62440</link>
      <description>&lt;P&gt;Since there is always a value for "mailfrom", coalesced_mail will always take this value and never the "mailto" value. No?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2016 13:56:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213008#M62440</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2016-02-22T13:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213009#M62441</link>
      <description>&lt;P&gt;Does your (every) event has both the fields (mailfrom, mailto) OR they are available in separate events?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2016 16:30:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213009#M62441</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-22T16:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213010#M62442</link>
      <description>&lt;P&gt;Each event has both fields.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2016 16:45:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213010#M62442</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2016-02-22T16:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213011#M62443</link>
      <description>&lt;P&gt;So, which Country you want to retrieve, for mailfrom , for mailto OR both?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2016 16:47:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213011#M62443</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-22T16:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213012#M62444</link>
      <description>&lt;P&gt;Well then your initial search with two lookups will never lookup any events from the second lookup either.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 07:41:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213012#M62444</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2016-02-23T07:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213013#M62445</link>
      <description>&lt;P&gt;Both, of course &lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 15:22:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213013#M62445</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2016-02-23T15:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213014#M62446</link>
      <description>&lt;P&gt;Why not? I tried it, it works. (but it is not very efficient I think. Hence my question.)&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 15:24:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213014#M62446</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2016-02-23T15:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213015#M62447</link>
      <description>&lt;P&gt;No, it can't work. &lt;CODE&gt;lookup OUTPUTNEW&lt;/CODE&gt; will not overwrite a field if it's already there, so either the first lookup did not return anything (and Country is still empty) or the second lookup has no effect. This is exactly the behavior &lt;CODE&gt;coalesce&lt;/CODE&gt; features, so it should be identical.&lt;/P&gt;

&lt;P&gt;For &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup#Usage"&gt;reference&lt;/A&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;If the OUTPUTNEW clause is specified, the lookup is not performed for events in which the output fields already exist
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Feb 2016 07:41:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213015#M62447</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2016-02-24T07:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213016#M62448</link>
      <description>&lt;P&gt;Oh OK... So any idea to make it work ?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 08:35:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213016#M62448</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2016-02-24T08:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213017#M62449</link>
      <description>&lt;P&gt;There is more than one way to "make this work". It depends on what you want to achieve, see somesoni2's question above.&lt;BR /&gt;
Consider what happens: you have two fields, mailto and mailfrom. They may be different, they may be the same. You could run a lookup on each of them, but then the output of those lookups may be different or may be the same, depending on the values of mailto and mailfrom. You could place the result of the lookup in two different fields, e.g. mailto_country and mailfrom_country, or you could only care for one of those - it depends on what you want to do. You can't, however, "make this work" by having only one lookup and one field. If you want one field containing the info "From Country - To Country", you could concatenate the two individual fields after looking them up.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:55:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213017#M62449</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2020-09-29T08:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213018#M62450</link>
      <description>&lt;P&gt;OK Thank you.&lt;BR /&gt;
In the end I decided to create two fields (mailto_country and mailfrom_country) with two lookups and to use mvappend(mailto_country,mailfrom_country) to create a mv field with all the countries.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:55:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213018#M62450</guid>
      <dc:creator>ctaf</dc:creator>
      <dc:date>2020-09-29T08:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can I perform a lookup on 1 lookup field AS 2 existing fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213019#M62451</link>
      <description>&lt;P&gt;I'm glad you found a solution that works for you. Two lookups in a search should not be too much of a performance hit, especially since assuming a lookup on countries only has a few hundred lines in it anyway.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 10:38:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-perform-a-lookup-on-1-lookup-field-AS-2-existing-fields/m-p/213019#M62451</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2016-02-24T10:38:14Z</dc:date>
    </item>
  </channel>
</rss>

