<?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: Got problem with mvexpand and its 500MB memory limit? Try a reverse stats join! in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Got-problem-with-mvexpand-and-its-500MB-memory-limit-Try-a/m-p/689650#M234992</link>
    <description>&lt;P&gt;This solution only works if all the values in the multivalue field are unique across all instances of the field. For example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=10
| eval mv=mvrange(0,(random()%5)+1)
| streamstats count as row
| stats values(*) as * by mv&lt;/LI-CODE&gt;&lt;P&gt;This produces only 5 events instead of between 10 and 50 events which mvexpand&amp;nbsp; of mv would have done&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jun 2024 06:46:01 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-06-05T06:46:01Z</dc:date>
    <item>
      <title>Got problem with mvexpand and its 500MB memory limit? Try a reverse stats join!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Got-problem-with-mvexpand-and-its-500MB-memory-limit-Try-a/m-p/689624#M234983</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;I had discovered you can emulate the &lt;FONT face="courier new,courier"&gt;mvexpand&lt;/FONT&gt; function to avoid its limitation configured by the limits.conf&amp;nbsp;&lt;/P&gt;&lt;P&gt;You just have to stats by the multivalue field you were trying to &lt;FONT face="courier new,courier"&gt;mvexpand&lt;/FONT&gt;, like so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats values(*) AS * by &amp;lt;multivalue_field&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That's it, (edit:) assuming each value is a unique value such as a unique identifier. You can make values unique using methods like foreach to pre-append a row-based number to each value, reverse join it, then use split and mvindex to remove the row numbers afterwards. (/Edit.)&lt;/P&gt;&lt;P&gt;Stats splits up &amp;lt;multivalue_field&amp;gt; into its individual rows, and the use of values(*) copies data across all rows.&lt;/P&gt;&lt;P&gt;As an added measure, you can make sure to avoid unnecessary _raw data to reduce memory use with an explicit &lt;FONT face="courier new,courier"&gt;fields&lt;/FONT&gt; just for it.&lt;/P&gt;&lt;P&gt;It was in my experience, it turned out using&lt;FONT face="courier new,courier"&gt; | fields _time, *&lt;/FONT&gt; trick does not actually remove every single Splunk internal fields. Removing _raw had to be explicit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| fields _time, xxx, yyy, zzz, &amp;lt;multivalue_field&amp;gt;
| fields - _raw
| stats values(*) AS * by &amp;lt;multivalue_field&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above strategy minimizes your search's disk space as much as possible before expanding the multivalue field.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 06:59:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Got-problem-with-mvexpand-and-its-500MB-memory-limit-Try-a/m-p/689624#M234983</guid>
      <dc:creator>ClubMed</dc:creator>
      <dc:date>2024-06-05T06:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Got problem with mvexpand and its 500MB memory limit? Try a reverse stats join!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Got-problem-with-mvexpand-and-its-500MB-memory-limit-Try-a/m-p/689650#M234992</link>
      <description>&lt;P&gt;This solution only works if all the values in the multivalue field are unique across all instances of the field. For example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults count=10
| eval mv=mvrange(0,(random()%5)+1)
| streamstats count as row
| stats values(*) as * by mv&lt;/LI-CODE&gt;&lt;P&gt;This produces only 5 events instead of between 10 and 50 events which mvexpand&amp;nbsp; of mv would have done&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 06:46:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Got-problem-with-mvexpand-and-its-500MB-memory-limit-Try-a/m-p/689650#M234992</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-05T06:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Got problem with mvexpand and its 500MB memory limit? Try a reverse stats join!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Got-problem-with-mvexpand-and-its-500MB-memory-limit-Try-a/m-p/689654#M234995</link>
      <description>&lt;P&gt;Test post. Wasn't able to post?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Edit: Okay, it works. Yes that is an caveat to bring up. Fortunately, you can use a foreach with an iterator to make each value in the multivalue unique. I'm thinking it is something like the following. I'm sure its not impossible to add a custom unique identifier to each value in mv field nonetheless.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval iterator=0
| foreach &amp;lt;multivalue_field&amp;gt;
[eval iterator=iterator+1, &amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;=iterator."-".&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt;]
``` Warning: Did not test this yet ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can perform the reverse stats join, and use split() and mvindex() to parse out your actual values without needing regex!&lt;/P&gt;&lt;P&gt;You are correct, I was indeed working with a multivalue of unique identifiers which is why it worked for me.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 07:17:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Got-problem-with-mvexpand-and-its-500MB-memory-limit-Try-a/m-p/689654#M234995</guid>
      <dc:creator>ClubMed</dc:creator>
      <dc:date>2024-06-05T07:17:43Z</dc:date>
    </item>
  </channel>
</rss>

