<?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: Split a MV field into different, multiple fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/577451#M201236</link>
    <description>&lt;P&gt;Genius. It works. Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 06 Dec 2021 11:17:47 GMT</pubDate>
    <dc:creator>mato666666</dc:creator>
    <dc:date>2021-12-06T11:17:47Z</dc:date>
    <item>
      <title>Split a MV field into different, multiple fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/577227#M201152</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a very specific problem. I have a field with following values at different timestamps. Example:&lt;/P&gt;&lt;P&gt;1,3,20&lt;/P&gt;&lt;P&gt;0&lt;/P&gt;&lt;P&gt;2,3,43,9,12&lt;/P&gt;&lt;P&gt;3,3,40,8,20,9,80&lt;/P&gt;&lt;P&gt;2,3,20,9,30&lt;/P&gt;&lt;P&gt;6,2,0,3,30,4,42,5,29,6,80,9,92&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This field actually represents very specific information, which I need to extract to feed my calculation.&lt;/P&gt;&lt;P&gt;The first number shows us how many fields are there to be extracted.&lt;/P&gt;&lt;P&gt;The second (and every other even number) is the name of the field to be extracted.&lt;/P&gt;&lt;P&gt;The third (and every other odd number) is the value of the field, whose name is stated just before.&lt;/P&gt;&lt;P&gt;That means that the last example I stated means that:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;There are six (6) fields to be extracted&lt;/LI&gt;&lt;LI&gt;The key:value pairs are:&lt;UL&gt;&lt;LI&gt;2:0&lt;/LI&gt;&lt;LI&gt;3:30&lt;/LI&gt;&lt;LI&gt;4:42&lt;/LI&gt;&lt;LI&gt;5:29&lt;/LI&gt;&lt;LI&gt;6:80&lt;/LI&gt;&lt;LI&gt;9:92&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I want to be able to extract these fields, assigning them the approriate name. Is there a command / function that handles this well?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 14:07:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/577227#M201152</guid>
      <dc:creator>mato666666</dc:creator>
      <dc:date>2021-12-03T14:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: Split a MV field into different, multiple fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/577240#M201155</link>
      <description>&lt;P&gt;You could try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="1,3,20
0
2,3,43,9,12
3,3,40,8,20,9,80
2,3,20,9,30
6,2,0,3,30,4,42,5,29,6,80,9,92"
| multikv noheader=t
| table _raw



| streamstats count as row 
| eval count=mvindex(split(_raw,","),0)
| rex mode=sed "s/,(?&amp;lt;mv&amp;gt;\d+,\d+)/!\1/g"
| rex max_match=0 "!(?&amp;lt;mv&amp;gt;\d+,\d+)"
| eval _raw=replace(_raw,"!",",")
| mvexpand mv
| eval name=mvindex(split(mv,","),0)
| eval value=mvindex(split(mv,","),1)
| eval {name}=value
| stats values(*) as * values(_raw) as _raw by row
| fields - row name value mv count&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Dec 2021 15:33:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/577240#M201155</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-12-03T15:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Split a MV field into different, multiple fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/577451#M201236</link>
      <description>&lt;P&gt;Genius. It works. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 11:17:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/577451#M201236</guid>
      <dc:creator>mato666666</dc:creator>
      <dc:date>2021-12-06T11:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: Split a MV field into different, multiple fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/578288#M201528</link>
      <description>&lt;P&gt;Hi again&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I am still working with the field extraction you helped me with (super solution, thanks!), however, I am now facing a new issue - the code is too heavy to run (runs 9 minutes instead of 4, and has 300MB instead of 1MB) - this is due to the last stats command &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;I have tried implementing a couple of solutions to this:&lt;BR /&gt;- streamstats and eventstats - these, however, cannot properly set the data back to its original state&lt;BR /&gt;- dedup - I thought this would be a better solution, but it turns out that dedup is even slower than stats&lt;BR /&gt;- using eval after streamstats, but then, I would just end up using stats command again&lt;BR /&gt;&lt;BR /&gt;I am yet to try data model acceleration, but maybe you know another way to speed it up? In my search, I only use the fast mode.&amp;nbsp; I am not able to reduce the time-range of the search, as I have already hit the minimum time range necessary for the dashboard to be useful.&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 08:24:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/578288#M201528</guid>
      <dc:creator>mato666666</dc:creator>
      <dc:date>2021-12-14T08:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Split a MV field into different, multiple fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/578290#M201530</link>
      <description>&lt;P&gt;Do you need to rebuild the rows or can you do you further calculations without? Do you need to keep _raw?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 09:32:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/578290#M201530</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-12-14T09:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Split a MV field into different, multiple fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/578430#M201587</link>
      <description>&lt;P&gt;I need the other fields to be back, as I need them for further calculation.&lt;BR /&gt;&lt;BR /&gt;I do not need _raw files - I removed _raw as _raw from the stats command, and that helped with the size of the search (now only 15mb), but still it takes 10 minutes instead of the original 5.&lt;/P&gt;&lt;P&gt;I tried this trick with streamstats instead, but it seems that streamstats doesn't really do anything and the duplicate rows are not removed.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 08:15:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Split-a-MV-field-into-different-multiple-fields/m-p/578430#M201587</guid>
      <dc:creator>mato666666</dc:creator>
      <dc:date>2021-12-15T08:15:00Z</dc:date>
    </item>
  </channel>
</rss>

