<?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 Is it possible to turn a multivalued field with an arbitrary number of elements into columns? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/209408#M61215</link>
    <description>&lt;P&gt;I have a search that generates two fields -- host and application.  Application is a multivalued field with varying numbers of results.  Assume the field is comma delimited in the example below.  It looks something like:&lt;/P&gt;

&lt;P&gt;host                            application&lt;BR /&gt;&lt;BR /&gt;
server1                       splunk,apache,named&lt;BR /&gt;&lt;BR /&gt;
server2                       apache,tomcat  &lt;/P&gt;

&lt;P&gt;I would like to convert it into the following column format:&lt;/P&gt;

&lt;P&gt;host        application1      application2      application3      application4...&lt;BR /&gt;
server1  splunk                apache                named&lt;BR /&gt;
server2  apache               tomcat&lt;/P&gt;

&lt;P&gt;I know I can use eval and mvindex to manually create each column name and then transpose them, but without some kind of for loop, I would have to create a search with the eval statements up to the maximum mvindex value I expect to see.  &lt;/P&gt;

&lt;P&gt;Is there any way to do this without having to manually create each new column name?&lt;/P&gt;

&lt;P&gt;Thx.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Feb 2016 23:00:51 GMT</pubDate>
    <dc:creator>responsys_cm</dc:creator>
    <dc:date>2016-02-19T23:00:51Z</dc:date>
    <item>
      <title>Is it possible to turn a multivalued field with an arbitrary number of elements into columns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/209408#M61215</link>
      <description>&lt;P&gt;I have a search that generates two fields -- host and application.  Application is a multivalued field with varying numbers of results.  Assume the field is comma delimited in the example below.  It looks something like:&lt;/P&gt;

&lt;P&gt;host                            application&lt;BR /&gt;&lt;BR /&gt;
server1                       splunk,apache,named&lt;BR /&gt;&lt;BR /&gt;
server2                       apache,tomcat  &lt;/P&gt;

&lt;P&gt;I would like to convert it into the following column format:&lt;/P&gt;

&lt;P&gt;host        application1      application2      application3      application4...&lt;BR /&gt;
server1  splunk                apache                named&lt;BR /&gt;
server2  apache               tomcat&lt;/P&gt;

&lt;P&gt;I know I can use eval and mvindex to manually create each column name and then transpose them, but without some kind of for loop, I would have to create a search with the eval statements up to the maximum mvindex value I expect to see.  &lt;/P&gt;

&lt;P&gt;Is there any way to do this without having to manually create each new column name?&lt;/P&gt;

&lt;P&gt;Thx.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 23:00:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/209408#M61215</guid>
      <dc:creator>responsys_cm</dc:creator>
      <dc:date>2016-02-19T23:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to turn a multivalued field with an arbitrary number of elements into columns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/209409#M61216</link>
      <description>&lt;P&gt;Try something like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving host, application | eval temp=mvrange(1,mvcount(application)+1) | rex field=temp mode=sed "s/(\d+)/application\1/g" | eval temp=mvzip(temp,application,"#") | mvexpand temp | table host temp | rex field=temp "(?&amp;lt;type&amp;gt;\w+)#(?&amp;lt;application&amp;gt;.*)" | chart values(application) over host by type limit=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2016 23:36:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/209409#M61216</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-19T23:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to turn a multivalued field with an arbitrary number of elements into columns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/209410#M61217</link>
      <description>&lt;P&gt;Let no one ever say you aren't a Splunk ninja.  Thank you so much!&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 23:58:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/209410#M61217</guid>
      <dc:creator>responsys_cm</dc:creator>
      <dc:date>2016-02-19T23:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to turn a multivalued field with an arbitrary number of elements into columns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/209411#M61218</link>
      <description>&lt;P&gt;Very powerful transaction. This should be a native command.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2017 16:04:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/209411#M61218</guid>
      <dc:creator>_jgpm_</dc:creator>
      <dc:date>2017-10-19T16:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to turn a multivalued field with an arbitrary number of elements into columns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/534388#M151006</link>
      <description>&lt;P&gt;Awesome search!&amp;nbsp; &amp;nbsp; &amp;nbsp;Thank you VERY much.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Dec 2020 21:12:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Is-it-possible-to-turn-a-multivalued-field-with-an-arbitrary/m-p/534388#M151006</guid>
      <dc:creator>pretzel2</dc:creator>
      <dc:date>2020-12-29T21:12:41Z</dc:date>
    </item>
  </channel>
</rss>

