<?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 you extract information from an array of key values in a column with multiple keys? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-information-from-an-array-of-key-values-in-a/m-p/447227#M77789</link>
    <description>&lt;P&gt;Working with MV fields is always a challenge. &lt;/P&gt;

&lt;P&gt;Try this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw = "{\"associates\":[{\"type\":\"a\",\"person\":\"person1\"},{\"type\":\"b\",\"person\":\"person2\"},{\"type\":\"b\",\"person\":\"person3\"},{\"type\":\"c\", \"person\": \"person3\"      }]}" 
| spath 
| rename associates{}.person as person associates{}.type as type 
| eval both=mvzip(person, type, "#####") 
| fields both 
| mvexpand both 
| makemv both delim="#####" 
| eval person=mvindex(both, 0) 
| eval type=mvindex(both, 1)
| search type = "b"
| table person
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 06 Feb 2019 20:09:49 GMT</pubDate>
    <dc:creator>chrisyounger</dc:creator>
    <dc:date>2019-02-06T20:09:49Z</dc:date>
    <item>
      <title>How do you extract information from an array of key values in a column with multiple keys?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-information-from-an-array-of-key-values-in-a/m-p/447226#M77788</link>
      <description>&lt;P&gt;So I've got an event that has an array of key values like so in a column called associated : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; associates: [
     {
       type: a
       person: person1
     },
     {
       type: b
       person: person2
     },
     {
       type: b
       person: person3
     },
     {
       type: c
       person: person3
     }...]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I can pull out all of the people associated with an issue doing the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rename associated{}.person as all_associates
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And pull out the "first" associate person like so&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval dathuman=mvindex(all_assoicates, 0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But, what I want to do is pull out just the associates of a particular type. So, something that get's me all the associates of type "b" only.&lt;/P&gt;

&lt;P&gt;What's the best way to do that?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Feb 2019 19:16:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-information-from-an-array-of-key-values-in-a/m-p/447226#M77788</guid>
      <dc:creator>chalbersma</dc:creator>
      <dc:date>2019-02-06T19:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract information from an array of key values in a column with multiple keys?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-information-from-an-array-of-key-values-in-a/m-p/447227#M77789</link>
      <description>&lt;P&gt;Working with MV fields is always a challenge. &lt;/P&gt;

&lt;P&gt;Try this: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw = "{\"associates\":[{\"type\":\"a\",\"person\":\"person1\"},{\"type\":\"b\",\"person\":\"person2\"},{\"type\":\"b\",\"person\":\"person3\"},{\"type\":\"c\", \"person\": \"person3\"      }]}" 
| spath 
| rename associates{}.person as person associates{}.type as type 
| eval both=mvzip(person, type, "#####") 
| fields both 
| mvexpand both 
| makemv both delim="#####" 
| eval person=mvindex(both, 0) 
| eval type=mvindex(both, 1)
| search type = "b"
| table person
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Feb 2019 20:09:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-information-from-an-array-of-key-values-in-a/m-p/447227#M77789</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-06T20:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do you extract information from an array of key values in a column with multiple keys?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-information-from-an-array-of-key-values-in-a/m-p/447228#M77790</link>
      <description>&lt;P&gt;We ended up solving this on the import of data instead of in the query. But this does indeed work. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Feb 2019 19:06:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-extract-information-from-an-array-of-key-values-in-a/m-p/447228#M77790</guid>
      <dc:creator>chalbersma</dc:creator>
      <dc:date>2019-02-07T19:06:32Z</dc:date>
    </item>
  </channel>
</rss>

