<?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 Expand multivalue field into individual fields WITHOUT mvexpand in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671751#M230165</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a multivalue field, which I would like to expand to individual fields, like so:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=1
| eval a=mvappend("1","7")

| eval a_0=mvindex(a,0,0)
| eval a_1=mvindex(a,1,1)&lt;/LI-CODE&gt;&lt;P&gt;However, the length might be &amp;gt;2 and I would like to have a generic solution to do this. I know I can create a MV field with an index and use mvexpand and then stats to get all back into a single event, but I run into memory issues with this in my own data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short: not use mvexpand and solve the issue in a generic fashion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Dec 2023 15:32:12 GMT</pubDate>
    <dc:creator>duesser</dc:creator>
    <dc:date>2023-12-13T15:32:12Z</dc:date>
    <item>
      <title>Expand multivalue field into individual fields WITHOUT mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671751#M230165</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a multivalue field, which I would like to expand to individual fields, like so:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=1
| eval a=mvappend("1","7")

| eval a_0=mvindex(a,0,0)
| eval a_1=mvindex(a,1,1)&lt;/LI-CODE&gt;&lt;P&gt;However, the length might be &amp;gt;2 and I would like to have a generic solution to do this. I know I can create a MV field with an index and use mvexpand and then stats to get all back into a single event, but I run into memory issues with this in my own data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short: not use mvexpand and solve the issue in a generic fashion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 15:32:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671751#M230165</guid>
      <dc:creator>duesser</dc:creator>
      <dc:date>2023-12-13T15:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Expand multivalue field into individual fields WITHOUT mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671755#M230167</link>
      <description>&lt;P&gt;I came up with this in the middle of last year - perhaps you can adapt it to your purposes?&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Enterprise/Mutlivalue-Field-Problem-Is-there-any-way-to-do-this-without/m-p/608898/highlight/true#M13589" target="_blank"&gt;Solved: Re: Mutlivalue Field Problem - Splunk Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 15:50:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671755#M230167</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-12-13T15:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Expand multivalue field into individual fields WITHOUT mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671762#M230168</link>
      <description>&lt;P&gt;Think I found a hacky way of doing this.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dtburrows3_0-1702485351189.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28493i3294884A93A4B7C5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dtburrows3_0-1702485351189.png" alt="dtburrows3_0-1702485351189.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Seems to recursive and should loop through all mvfield values, assigning each one its own unique field name.&lt;BR /&gt;&lt;BR /&gt;You can replicate this with this SPL.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
    | eval
        mv_field=split("a|b|c|d|e|f|aa", "|")
        
    ``` Below SPL is what loops through MV field and gives each entry its own unique fieldname ```
    | eval
        iter=0,
        hacked_json=json_object()
    | foreach mode=multivalue mv_field
        [
            | eval
                iter='iter'+1,
                hacked_json=json_set(hacked_json, "mv_field_".'iter', '&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;')
                    
            ]
    | spath input=hacked_json
    | fields - hacked_json, iter&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 13 Dec 2023 16:38:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671762#M230168</guid>
      <dc:creator>dtburrows3</dc:creator>
      <dc:date>2023-12-13T16:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Expand multivalue field into individual fields WITHOUT mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671809#M230185</link>
      <description>&lt;P&gt;It's unfortunate that &lt;STRONG&gt;field_{&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;}=&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;&lt;/STRONG&gt; does not work inside an MV foreach statement - the {} assignment does work if mode is not multivalue&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 22:19:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671809#M230185</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-12-13T22:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Expand multivalue field into individual fields WITHOUT mvexpand</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671853#M230207</link>
      <description>&lt;P&gt;Yes for real! That was my first idea. I think for static field length one could use something along this line of thought (does not work as is but should be doable):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval
    mv_field=split("a|b|c|d|e|f|aa", "|") 
| fields ```other fields of interest``` mv_field [| makeresults count=7
| streamstats count
| eval temp="mv_field_",
    fieldname=temp.count 
| stats values(fieldname) AS fieldname 
| return $fieldname] 
| foreach mode=multifield mv_field_* 
[ eval "&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"=mvindex(mv_field,tonumber(&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;),tonumber(&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;))]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but seing this solution it is more elegant and general&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 08:11:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Expand-multivalue-field-into-individual-fields-WITHOUT-mvexpand/m-p/671853#M230207</guid>
      <dc:creator>duesser</dc:creator>
      <dc:date>2023-12-14T08:11:41Z</dc:date>
    </item>
  </channel>
</rss>

