<?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: Multivalued fields in a lookup file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341882#M101293</link>
    <description>&lt;P&gt;Multivalued fields are supported in &lt;CODE&gt;KV-based&lt;/CODE&gt; lookups, but not in &lt;CODE&gt;file-based&lt;/CODE&gt; lookups.  Switch to a &lt;CODE&gt;KV Store&lt;/CODE&gt;.&lt;BR /&gt;
Or, do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup MyLookup.csv
| makemv delim=" " emails
| mvexpand emails
| outputcsv MyLookup.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then create a &lt;CODE&gt;Lookup definition&lt;/CODE&gt; with &lt;CODE&gt;Maximum matches&lt;/CODE&gt; set to something large like &lt;CODE&gt;20&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Sun, 17 Dec 2017 03:22:26 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-12-17T03:22:26Z</dc:date>
    <item>
      <title>Multivalued fields in a lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341879#M101290</link>
      <description>&lt;P&gt;I have a csv file like :&lt;BR /&gt;
User_id,emails&lt;BR /&gt;
375352,&lt;A href="mailto:foo@foo.com" target="_blank"&gt;foo@foo.com&lt;/A&gt; &lt;A href="mailto:foo@foo.ca" target="_blank"&gt;foo@foo.ca&lt;/A&gt; &lt;A href="mailto:foobar@foobar.co.uk" target="_blank"&gt;foobar@foobar.co.uk&lt;/A&gt;&lt;BR /&gt;
872352,&lt;A href="mailto:toto@foo.com" target="_blank"&gt;toto@foo.com&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;note: email addresses are blank separated within the csv file&lt;/P&gt;

&lt;P&gt;On the other hand I have an email log file in which I have fields such as x_recipients, x_sender that contain email addresses &lt;/P&gt;

&lt;P&gt;What I would like to achieve is a search based on the User_id that will show all emails sent or received. What i have done so far is a lookup that matches my event field x_recipient with my csv field emails to output the User_id. It works but only for csv entries where emails has only one value (&lt;A href="mailto:toto@foo.com" target="_blank"&gt;toto@foo.com&lt;/A&gt; in my example).&lt;/P&gt;

&lt;P&gt;Any idea why I have this behaviour ?&lt;/P&gt;

&lt;P&gt;Many thanks &lt;BR /&gt;
Laurent&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:15:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341879#M101290</guid>
      <dc:creator>lzaexpert</dc:creator>
      <dc:date>2020-09-29T17:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalued fields in a lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341880#M101291</link>
      <description>&lt;P&gt;It has that behavior because the "multivalue" field in the lookup table has been flattened into a string. &lt;/P&gt;

&lt;P&gt;Try something like this... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; your base search here  
 ( [| inputlookup myemails.csv | where User_id = "375352" | table emails | makemv emails | mvexpand emails | rename emails as  x_recipients ]) 
| the rest of your search code
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When you have that working for the recipient field, add something like this... &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; OR 
 ( [| inputlookup myemails.csv | where User_id = "375352" | table emails  | makemv emails | mvexpand emails | rename emails as  x_sender ]) 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Dec 2017 15:36:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341880#M101291</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-12-15T15:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalued fields in a lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341881#M101292</link>
      <description>&lt;P&gt;If possible, change the lookup table format to be linear with each email appearing in separate row.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;email, user_id
foo@foo.com,375352
foo@foo.ca,375352
...
..
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Your searching would be much easier.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2017 16:19:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341881#M101292</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-12-15T16:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalued fields in a lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341882#M101293</link>
      <description>&lt;P&gt;Multivalued fields are supported in &lt;CODE&gt;KV-based&lt;/CODE&gt; lookups, but not in &lt;CODE&gt;file-based&lt;/CODE&gt; lookups.  Switch to a &lt;CODE&gt;KV Store&lt;/CODE&gt;.&lt;BR /&gt;
Or, do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup MyLookup.csv
| makemv delim=" " emails
| mvexpand emails
| outputcsv MyLookup.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then create a &lt;CODE&gt;Lookup definition&lt;/CODE&gt; with &lt;CODE&gt;Maximum matches&lt;/CODE&gt; set to something large like &lt;CODE&gt;20&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Dec 2017 03:22:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341882#M101293</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-12-17T03:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalued fields in a lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341883#M101294</link>
      <description>&lt;P&gt;At some point, they added output_format=splunk_mv_csv to the outputlookup command which allows for mv fields in lookups.&lt;/P&gt;

&lt;P&gt;It appears that lookups created with output_format=splunk_mv_csv are quoted with CRLF's OR commas between the multivalues, but also have "_&lt;EM&gt;mv&lt;/EM&gt;" quoted in header because they start with "_" ( "_raw" was quoted in the header in my testing.)&lt;/P&gt;

&lt;P&gt;CRLF also known as \r\n.&lt;/P&gt;

&lt;P&gt;Both of the examples below worked on splunk 7.x:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mvfield,"__mv_mvfield",otherfield,otherfields
"value1
value2
value3","$value1$;$value2$;$value3$","otherfield","otherfields"

mvfield,"__mv_mvfield",otherfield,otherfields
"value1,value2,value3","$value1$;$value2$;$value3$","otherfield","otherfields"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope this helps others!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:43:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341883#M101294</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-09-30T01:43:23Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalued fields in a lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341884#M101295</link>
      <description>&lt;P&gt;I am pretty sure that this option existed as undocumented (and mostly unused) for a LONG time, definitely in v6.?, but nobody noticed it because the default is to not do this.  I noticed it as far back as v4.? inside of &lt;CODE&gt;restults.gz&lt;/CODE&gt; but did not understand what it was.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 17:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341884#M101295</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-14T17:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalued fields in a lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341885#M101296</link>
      <description>&lt;P&gt;I think that &lt;CODE&gt;no longer applies&lt;/CODE&gt; is an inaccurate way to put it, because it it definitely &lt;CODE&gt;applies&lt;/CODE&gt; but with additional provisos due to recent discoveries.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Aug 2019 17:14:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341885#M101296</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-14T17:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalued fields in a lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341886#M101297</link>
      <description>&lt;P&gt;Yeah i just read that and said "it still applies, what was i thinking?" because KVstore is a perfectly acceptable solution here too.&lt;/P&gt;

&lt;P&gt;Editing my answer now.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 13:59:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341886#M101297</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2019-08-15T13:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalued fields in a lookup file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341887#M101298</link>
      <description>&lt;P&gt;Upvoted everything.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 15:24:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Multivalued-fields-in-a-lookup-file/m-p/341887#M101298</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-15T15:24:10Z</dc:date>
    </item>
  </channel>
</rss>

