<?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: Multivalue field to multiple fields in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331876#M93087</link>
    <description>&lt;P&gt;It can be any&lt;/P&gt;</description>
    <pubDate>Fri, 13 Apr 2018 11:04:47 GMT</pubDate>
    <dc:creator>yurykiselev</dc:creator>
    <dc:date>2018-04-13T11:04:47Z</dc:date>
    <item>
      <title>Multivalue field to multiple fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331871#M93082</link>
      <description>&lt;P&gt;Hi!&lt;BR /&gt;
How to split multivalue field, e.g. JSON array elements (&lt;EM&gt;value&lt;/EM&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
  "id": 4321,
  "value": [
   5, 6, 7, 8
  ]
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;id     | value
4321     5 6 7 8
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;to multiple fileds with some index remaining one event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;id     | value_0 | value_1 | value_2 | value_3
4321     5         6         7         8
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 13:34:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331871#M93082</guid>
      <dc:creator>yurykiselev</dc:creator>
      <dc:date>2018-04-11T13:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue field to multiple fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331872#M93083</link>
      <description>&lt;P&gt;Depends on the consistency of the value field but if it's always 4 numbers you could use something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=value "(?P&amp;lt;value_0&amp;gt;\d+)\s(?P&amp;lt;value_1&amp;gt;\d+)\s(?P&amp;lt;value_2&amp;gt;\d+)\s(?P&amp;lt;value_3&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Apr 2018 13:46:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331872#M93083</guid>
      <dc:creator>damien_chillet</dc:creator>
      <dc:date>2018-04-11T13:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue field to multiple fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331873#M93084</link>
      <description>&lt;P&gt;Can you try :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval abc="5 6 7 8"|eval temp=split(abc," ") | eval mv1 = mvindex(temp, 0) | eval mv2 = mvindex(temp, 1) | eval mv3 = mvindex(temp, 2) | eval mv4 = mvindex(temp, 3)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Apr 2018 14:06:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331873#M93084</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-04-11T14:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue field to multiple fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331874#M93085</link>
      <description>&lt;P&gt;@yurykiselev, would there be 4 values under &lt;CODE&gt;value&lt;/CODE&gt; list or it can be any number of values?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 14:13:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331874#M93085</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-04-11T14:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue field to multiple fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331875#M93086</link>
      <description>&lt;P&gt;It's good idea:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval mv1 = mvindex(temp, 0) | eval mv2 = mvindex(temp, 1) | eval mv3 = mvindex(temp, 2) | eval mv4 = mvindex(temp, 3)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;, but size of &lt;EM&gt;value&lt;/EM&gt; is variable and I need to create &lt;EM&gt;mv1..n&lt;/EM&gt; dynamically&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 08:16:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331875#M93086</guid>
      <dc:creator>yurykiselev</dc:creator>
      <dc:date>2018-04-12T08:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue field to multiple fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331876#M93087</link>
      <description>&lt;P&gt;It can be any&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 11:04:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331876#M93087</guid>
      <dc:creator>yurykiselev</dc:creator>
      <dc:date>2018-04-13T11:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue field to multiple fields</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331877#M93088</link>
      <description>&lt;P&gt;@yurykiselev, please try the following run anywhere search which mimics two JSON data one with 4 values and another with three. The commands from &lt;CODE&gt;| makeresults&lt;/CODE&gt; till &lt;CODE&gt;|  fields - _raw _time&lt;/CODE&gt; generates the dummy data, instead of which you would need to use your current search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  makeresults
|  eval _raw=" {
   \"id\": 4321,
   \"value\": [
    5, 6, 7, 8
   ]
 }"
 | append 
    [|  makeresults
|  eval _raw=" {
   \"id\": 1234,
   \"value\": [
    1, 2, 3
   ]
 }"]
 |  spath
 |  fields - _raw _time
 |  rename "value{}" as value
 |  eval values_count=mvcount(value)+1
 |  eval counter=mvrange(1,values_count)
 |  eval value=mvzip(value,counter)
 |  fields - counter values_count
 |  mvexpand value
 |  eval value=split(value,",")
 |  eval counter="value_".mvindex(value,1),value=mvindex(value,0)
 |  chart values(value) by id counter
 |  fillnull value=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Apr 2018 17:12:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Multivalue-field-to-multiple-fields/m-p/331877#M93088</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-04-13T17:12:33Z</dc:date>
    </item>
  </channel>
</rss>

