<?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: What are search command alternatives to mvxpand for expansion with filter? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/What-are-search-command-alternatives-to-mvxpand-for-expansion/m-p/316535#M59171</link>
    <description>&lt;P&gt;Actually, your question and the problem don't seem to be related.  You haven't told us the method you attempted to use to count the sections, nor how f and x are determined.  For example, do you need a sum of how many f's are x, and how many are y? Here's a quick and dirty version that should do that without any fuss for up to a couple hundred thousand records.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search...
| rex "{(?&amp;lt;key&amp;gt;[^={]+)=(?&amp;lt;value&amp;gt;[^}]+)}" max_match=0
| eval keyvalue=mvzip(key,value,"=")
| streamstats count as recno
| table recno keyvalue 
| mvexpand keyvalue
| rex "^(?&amp;lt;key&amp;gt;[^=]+)=(?&amp;lt;value&amp;gt;.+)$"  
| stats count by recno key value
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 01 Dec 2017 22:08:35 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-12-01T22:08:35Z</dc:date>
    <item>
      <title>What are search command alternatives to mvxpand for expansion with filter?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/What-are-search-command-alternatives-to-mvxpand-for-expansion/m-p/316533#M59169</link>
      <description>&lt;P&gt;I have a log line logically looking something like this:&lt;/P&gt;

&lt;P&gt;f1=a   f2=b   f3=c   custom=[]{ c1{f=x}  c2{f=y} c3{f=x}}&lt;/P&gt;

&lt;P&gt;I need to count the number of c sections where f=x, for example in above it's 2.  &lt;/P&gt;

&lt;P&gt;I'm getting quite a lot of errors while using mvexpand: &lt;STRONG&gt;"command.mvexpand: output will be truncated at 6100 results due to excessive memory usage. Memory threshold of 500MB has been reached"&lt;/STRONG&gt; due to this I believe there the result counts are not accrurate.&lt;/P&gt;

&lt;P&gt;I have removed the all fields including _raw before mvexpand (which helped a lot) but still mvexpand errors come up.&lt;/P&gt;

&lt;P&gt;How have people solved this in past?  will any of the bellow work?&lt;BR /&gt;
     - run the script on smaller time range then aggregate it outside of splunk&lt;BR /&gt;
     - use alternative ways instead of mvexpand to do expansion with filter?&lt;/P&gt;

&lt;P&gt;thx...&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 05:33:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/What-are-search-command-alternatives-to-mvxpand-for-expansion/m-p/316533#M59169</guid>
      <dc:creator>dtakacssplunk</dc:creator>
      <dc:date>2017-12-01T05:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: What are search command alternatives to mvxpand for expansion with filter?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/What-are-search-command-alternatives-to-mvxpand-for-expansion/m-p/316534#M59170</link>
      <description>&lt;P&gt;@dtakacssplunk, you will have to provide a better sample of your data. For c section to be multivalued field you should have c and not c1, c2 etc. If it is jSON then you should provide syntactically correct structure, better anonymize data rather than mocking so that data pattern can be anticipated.&lt;/P&gt;

&lt;P&gt;Can you try &lt;CODE&gt;mvfilter()&lt;/CODE&gt; for specific value in multivalued filed and then perform &lt;CODE&gt;mvcount()&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;If not you can also try to use &lt;CODE&gt;rex&lt;/CODE&gt; with &lt;CODE&gt;max_match=0&lt;/CODE&gt; to extract only the field you are interested in. However, for us to assist you would need to provide mocked anonymized data since regular expression is based on pattern matching.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 06:53:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/What-are-search-command-alternatives-to-mvxpand-for-expansion/m-p/316534#M59170</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-01T06:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: What are search command alternatives to mvxpand for expansion with filter?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/What-are-search-command-alternatives-to-mvxpand-for-expansion/m-p/316535#M59171</link>
      <description>&lt;P&gt;Actually, your question and the problem don't seem to be related.  You haven't told us the method you attempted to use to count the sections, nor how f and x are determined.  For example, do you need a sum of how many f's are x, and how many are y? Here's a quick and dirty version that should do that without any fuss for up to a couple hundred thousand records.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search...
| rex "{(?&amp;lt;key&amp;gt;[^={]+)=(?&amp;lt;value&amp;gt;[^}]+)}" max_match=0
| eval keyvalue=mvzip(key,value,"=")
| streamstats count as recno
| table recno keyvalue 
| mvexpand keyvalue
| rex "^(?&amp;lt;key&amp;gt;[^=]+)=(?&amp;lt;value&amp;gt;.+)$"  
| stats count by recno key value
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Dec 2017 22:08:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/What-are-search-command-alternatives-to-mvxpand-for-expansion/m-p/316535#M59171</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-12-01T22:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: What are search command alternatives to mvxpand for expansion with filter?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/What-are-search-command-alternatives-to-mvxpand-for-expansion/m-p/316536#M59172</link>
      <description>&lt;P&gt;Show us your search.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 22:51:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/What-are-search-command-alternatives-to-mvxpand-for-expansion/m-p/316536#M59172</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-12-01T22:51:13Z</dc:date>
    </item>
  </channel>
</rss>

