<?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 do I use lookups where field has two formats? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-lookups-where-field-has-two-formats/m-p/411391#M118674</link>
    <description>&lt;P&gt;And the issue is that the second lookup in your search clears the values set by the first lookup, when the username is in the format of an email?&lt;/P&gt;

&lt;P&gt;Try it with &lt;CODE&gt;OUTPUTNEW&lt;/CODE&gt; instead of &lt;CODE&gt;OUTPUT&lt;/CODE&gt;, so it doesn't overwrite anything that resulted from the first lookup.&lt;/P&gt;

&lt;P&gt;Alternatively: modify your lookup to contain an extra column say &lt;CODE&gt;key&lt;/CODE&gt;, which is multivalued and contains both samaccountname and mail values. Then you can do the lookup once, against that &lt;CODE&gt;key&lt;/CODE&gt; field.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Nov 2018 14:10:24 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2018-11-26T14:10:24Z</dc:date>
    <item>
      <title>How do I use lookups where field has two formats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-lookups-where-field-has-two-formats/m-p/411390#M118673</link>
      <description>&lt;P&gt;Owing to the way exchange outputs log files, for some reason we get two versions of the cs_username field&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;username  eg employeebob&lt;BR /&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Email address  eg &lt;A href="mailto:Bob.Employee@work.com"&gt;Bob.Employee@work.com&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Both versions exist in the active directory lookup file we have as "sAMAccountName" and "mail" and I want to get an output field of "Email Address".&lt;/P&gt;

&lt;P&gt;I can get lookup files to work on either version during a search, but not on both at the same time in the same search.&lt;/P&gt;

&lt;P&gt;Is there a way of running two lookups on the same file in the same search against the same field?&lt;/P&gt;

&lt;P&gt;Was looking at the "if" and "where" options, but they don't appear to work. Also, I tried to set two lookups in the same search.....&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=msexchange sourcetype="MSWindows:2008R2:IIS" WebApplication="Microsoft-Server-ActiveSync" Cmd=Sync 
| lookup User_Info mail AS cs_username OUTPUT l AS Location, title AS Title, department AS Department, mail AS "Email Address"
| lookup User_Info sAMAccountName AS cs_username OUTPUT l AS Location, title AS Title, department AS Department, mail AS "Email Address"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Nov 2018 14:06:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-lookups-where-field-has-two-formats/m-p/411390#M118673</guid>
      <dc:creator>capilarity</dc:creator>
      <dc:date>2018-11-26T14:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I use lookups where field has two formats?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-lookups-where-field-has-two-formats/m-p/411391#M118674</link>
      <description>&lt;P&gt;And the issue is that the second lookup in your search clears the values set by the first lookup, when the username is in the format of an email?&lt;/P&gt;

&lt;P&gt;Try it with &lt;CODE&gt;OUTPUTNEW&lt;/CODE&gt; instead of &lt;CODE&gt;OUTPUT&lt;/CODE&gt;, so it doesn't overwrite anything that resulted from the first lookup.&lt;/P&gt;

&lt;P&gt;Alternatively: modify your lookup to contain an extra column say &lt;CODE&gt;key&lt;/CODE&gt;, which is multivalued and contains both samaccountname and mail values. Then you can do the lookup once, against that &lt;CODE&gt;key&lt;/CODE&gt; field.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 14:10:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-use-lookups-where-field-has-two-formats/m-p/411391#M118674</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-11-26T14:10:24Z</dc:date>
    </item>
  </channel>
</rss>

