<?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: Splitting multi-value field (json) in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480456#M82372</link>
    <description>&lt;P&gt;Hi, @rsantkumar &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;basequery 
| spath path=data.plugins{} output=Plugins
| stats count by Plugins
| spath input=Plugins
| rename updates{}.release{}.* as *
| table key version date
| rename key as Plugin, version as Plugin_Version, date as Release_Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;key is not same &lt;CODE&gt;mvcount&lt;/CODE&gt; with version and date.&lt;BR /&gt;
I'm not sure your logs. maybe works.&lt;/P&gt;</description>
    <pubDate>Thu, 05 Mar 2020 02:08:10 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-03-05T02:08:10Z</dc:date>
    <item>
      <title>Splitting multi-value field (json)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480452#M82368</link>
      <description>&lt;P&gt;Hello Splunkers,&lt;/P&gt;

&lt;P&gt;So I am having trouble with some json nested arrays that contain multiple latitude and longitude in one event.&lt;BR /&gt;
Is there any way that I can split this one event up into 4 single events?&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/8449i9DFB73BC6D6B3310/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 14:40:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480452#M82368</guid>
      <dc:creator>nwenzl_splunk</dc:creator>
      <dc:date>2020-02-28T14:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting multi-value field (json)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480453#M82369</link>
      <description>&lt;P&gt;Yes, use mvexpand.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.2/SearchReference/Mvexpand"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.2/SearchReference/Mvexpand&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2020 15:29:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480453#M82369</guid>
      <dc:creator>codebuilder</dc:creator>
      <dc:date>2020-02-28T15:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting multi-value field (json)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480454#M82370</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;your_search
| spath "events.data{}.place.location.latitude" output=event.latitude 
| spath "events.data{}.place.location.longitude" output=event.longitude
| table event.latitude event.longitude
| eval counter=mvrange(0,mvcount(event.latitude))
| mvexpand counter
| rename counter as _counter
| foreach * [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = mvindex('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;', _counter) ]
| fields - _counter
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Feb 2020 18:14:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480454#M82370</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-02-28T18:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting multi-value field (json)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480455#M82371</link>
      <description>&lt;P&gt;Hi to4kawa,&lt;/P&gt;

&lt;P&gt;Thanks for your input your comment helped me a lot. I am doing something similar but unable to succeed after multiple attempts. &lt;/P&gt;

&lt;P&gt;I am parsing a JSON to fetch &lt;EM&gt;plugin names, version and release dates.&lt;/EM&gt; &lt;BR /&gt;
SO each plugin can have one or more release versions available &lt;/P&gt;

&lt;P&gt;I am unable to expand the plugin names nomatter what i do:&lt;/P&gt;

&lt;P&gt;please see below:&lt;/P&gt;

&lt;P&gt;Plugin                                  Plugin_Version                                                               Release_Date&lt;BR /&gt;
aemrules                            1.0                                                                                      2020-02-07&lt;BR /&gt;
csharp                                  8.3 (build 14607)                                                                2020-02-05&lt;BR /&gt;
cpp                                         8.4 (build 15306)                                                                2020-02-21 &lt;BR /&gt;
                                                6.0.2 (build 20657)                                                      2020-01-31&lt;BR /&gt;
                                                6.1 (build 20866)                                                                2020-02-14&lt;/P&gt;

&lt;P&gt;Ideally it should be:&lt;/P&gt;

&lt;P&gt;Plugin                                  Plugin_Version                                                               Release_Date&lt;BR /&gt;
aemrules                            1.0                                                                                      2020-02-07&lt;BR /&gt;
csharp                                  8.3 (build 14607)                                                                2020-02-05&lt;BR /&gt;
csharp                                  8.4 (build 15306)                                                                2020-02-21 &lt;BR /&gt;
cpp                                         6.0.2 (build 20657)                                                      2020-01-31&lt;BR /&gt;
cpp                                         6.1 (build 20866)                                                                2020-02-14&lt;/P&gt;

&lt;P&gt;the query that i use is :&lt;/P&gt;

&lt;P&gt;basequery|eval json_field = _raw&lt;BR /&gt;
 | spath input=json_field path=data.plugins{}.key output=Plugin&lt;BR /&gt;
 | spath input=json_field path=data.plugins{}.updates{}.release{}.version output=Plugin_Version&lt;BR /&gt;
 |spath input=json_field path=data.plugins{}.updates{}.release{}.date output=Release_Date&lt;BR /&gt;
 | eval counter=mvrange(0,mvcount(Plugin_Version))&lt;BR /&gt;
 | mvexpand counter&lt;BR /&gt;
 | rename counter as _counter&lt;BR /&gt;
 | foreach * [ eval &amp;lt;&amp;gt; = mvindex('&amp;lt;&amp;gt;', _counter) ]&lt;BR /&gt;
 | fields - _counter&lt;BR /&gt;
 | table Plugin Plugin_Version Release_Date&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:29:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480455#M82371</guid>
      <dc:creator>rsantkumar</dc:creator>
      <dc:date>2020-09-30T04:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting multi-value field (json)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480456#M82372</link>
      <description>&lt;P&gt;Hi, @rsantkumar &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;basequery 
| spath path=data.plugins{} output=Plugins
| stats count by Plugins
| spath input=Plugins
| rename updates{}.release{}.* as *
| table key version date
| rename key as Plugin, version as Plugin_Version, date as Release_Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;key is not same &lt;CODE&gt;mvcount&lt;/CODE&gt; with version and date.&lt;BR /&gt;
I'm not sure your logs. maybe works.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 02:08:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480456#M82372</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-05T02:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting multi-value field (json)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480457#M82373</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Update:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I got it to work by first combining the respective coordinates with mvzip, then breaking the pairs apart again with mvexpand and finally creating latitude and longitude fields with regex capture groups. Hope it can help somebody else!&lt;/P&gt;

&lt;P&gt;| head 1&lt;BR /&gt;
| spath output=event.latitude path=events.data{}.place.location.latitude&lt;BR /&gt;
| spath output=event.longitude path=events.data{}.place.location.longitude&lt;BR /&gt;
| table event.latitude, event.longitude&lt;BR /&gt;
| eval test = mvzip('event.latitude', 'event.longitude', ";")&lt;BR /&gt;
| fields - event.*&lt;BR /&gt;
| mvexpand test&lt;BR /&gt;
| rex field=test "(?&amp;lt;&lt;EM&gt;latitude&lt;/EM&gt;&amp;gt;.&lt;EM&gt;);(?&amp;lt;*longitude&lt;/EM&gt;&amp;gt;.*)"&lt;BR /&gt;
| fields - test&lt;BR /&gt;
| geostats latfield=latitude longfield=longitude count&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:29:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splitting-multi-value-field-json/m-p/480457#M82373</guid>
      <dc:creator>nwenzl_splunk</dc:creator>
      <dc:date>2020-09-30T04:29:55Z</dc:date>
    </item>
  </channel>
</rss>

