<?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: How to count the results of a rex that returns multiple matches as a single group of matches? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343329#M101667</link>
    <description>&lt;P&gt;I appreciate the response.  Unfortunately, &lt;CODE&gt;mvexpand namespace&lt;/CODE&gt; didn't do what I expected.  This is my original search.  The results return all the namespaces within the stacktrace for a row.  I would like to group each set of matches within a stacktrace and return a count.  Instead, it's grouping on each individual match.  Hope this makes sense.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod" sourcetype="app_logging_exceptions" ExStackTrace&amp;lt;&amp;gt;"" ExGlobalException="1" | rex field=ExStackTrace "(?: *)at (?:(?[\w\d_.]*)\.)?(?[\w\d_.]*(\.[\w\d_.&amp;lt;&amp;gt;]+)?)\.(?[\w\d_\[\]&amp;lt;&amp;gt;]*)\((?:(?[\w\d_]+(?:\[\]|&amp;amp;|\*)? [\w\d_]+)(?:, )?)*\)(?: *in *(?[^:]+(?::[^:]+)?))?(?::line *(?\d+))?" max_match=100| table namespace
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 Sep 2017 15:43:51 GMT</pubDate>
    <dc:creator>bschaap</dc:creator>
    <dc:date>2017-09-20T15:43:51Z</dc:date>
    <item>
      <title>How to count the results of a rex that returns multiple matches as a single group of matches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343327#M101665</link>
      <description>&lt;P&gt;I have results from a rex statement that looks something like the first set of results.  The rex returns multiple matches per row.  I am trying to use the &lt;EM&gt;stats&lt;/EM&gt; function to group multiple matches as a single group (see &lt;STRONG&gt;&lt;EM&gt;Desired&lt;/EM&gt;&lt;/STRONG&gt;).  However, my &lt;EM&gt;stats&lt;/EM&gt; statement currently sees each match as a separate group (see &lt;STRONG&gt;&lt;EM&gt;Not Desired&lt;/EM&gt;&lt;/STRONG&gt;).  Is there a way to return the &lt;STRONG&gt;&lt;EM&gt;Desired&lt;/EM&gt;&lt;/STRONG&gt; result?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Multi-match rex results&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
&lt;STRONG&gt;namespace&lt;/STRONG&gt;&lt;BR /&gt;
.........................................................&lt;BR /&gt;
System.ServiceModel.Channels&lt;BR /&gt;
System.ServiceModel.Dispatcher&lt;BR /&gt;
..........................................................&lt;BR /&gt;
System.ServiceModel.Channels&lt;BR /&gt;
System.ServiceModel.Dispatcher&lt;BR /&gt;
..........................................................&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Statement&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
... |stats count by namespace&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Desired&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
&lt;STRONG&gt;namespace&lt;/STRONG&gt;                       &lt;STRONG&gt;count&lt;/STRONG&gt;&lt;BR /&gt;
.........................................................................................&lt;BR /&gt;
System.ServiceModel.Channels        2&lt;BR /&gt;
System.ServiceModel.Dispatcher&lt;BR /&gt;
.........................................................................................&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Not Desired&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;
&lt;STRONG&gt;namespace&lt;/STRONG&gt;                       &lt;STRONG&gt;count&lt;/STRONG&gt;&lt;BR /&gt;
.........................................................................................&lt;BR /&gt;
System.ServiceModel.Channels        1&lt;BR /&gt;
System.ServiceModel.Dispatcher              1&lt;BR /&gt;
.........................................................................................&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 14:15:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343327#M101665</guid>
      <dc:creator>bschaap</dc:creator>
      <dc:date>2017-09-20T14:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the results of a rex that returns multiple matches as a single group of matches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343328#M101666</link>
      <description>&lt;P&gt;Not being able to see more of your search, and assuming a few things from what you said, I'd attempt the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | mvexpand namespace | stats count by namespace
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Sep 2017 15:23:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343328#M101666</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-09-20T15:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the results of a rex that returns multiple matches as a single group of matches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343329#M101667</link>
      <description>&lt;P&gt;I appreciate the response.  Unfortunately, &lt;CODE&gt;mvexpand namespace&lt;/CODE&gt; didn't do what I expected.  This is my original search.  The results return all the namespaces within the stacktrace for a row.  I would like to group each set of matches within a stacktrace and return a count.  Instead, it's grouping on each individual match.  Hope this makes sense.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod" sourcetype="app_logging_exceptions" ExStackTrace&amp;lt;&amp;gt;"" ExGlobalException="1" | rex field=ExStackTrace "(?: *)at (?:(?[\w\d_.]*)\.)?(?[\w\d_.]*(\.[\w\d_.&amp;lt;&amp;gt;]+)?)\.(?[\w\d_\[\]&amp;lt;&amp;gt;]*)\((?:(?[\w\d_]+(?:\[\]|&amp;amp;|\*)? [\w\d_]+)(?:, )?)*\)(?: *in *(?[^:]+(?::[^:]+)?))?(?::line *(?\d+))?" max_match=100| table namespace
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Sep 2017 15:43:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343329#M101667</guid>
      <dc:creator>bschaap</dc:creator>
      <dc:date>2017-09-20T15:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the results of a rex that returns multiple matches as a single group of matches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343330#M101668</link>
      <description>&lt;P&gt;Give this a try. The nomv command will convert your multivalued field to regular, linear field. This way the stats will treat them as one group, instead of individual values. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="prod" sourcetype="app_logging_exceptions" ExStackTrace&amp;lt;&amp;gt;"" ExGlobalException="1" | rex field=ExStackTrace "(?: *)at (?:(?[\w\d_.]*)\.)?(?[\w\d_.]*(\.[\w\d_.&amp;lt;&amp;gt;]+)?)\.(?[\w\d_\[\]&amp;lt;&amp;gt;]*)\((?:(?[\w\d_]+(?:\[\]|&amp;amp;|\*)? [\w\d_]+)(?:, )?)*\)(?: *in *(?[^:]+(?::[^:]+)?))?(?::line *(?\d+))?" max_match=100| table namespace | nomv namespace | stats count by namespace | makemv namespace
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Sep 2017 16:36:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343330#M101668</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-09-20T16:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the results of a rex that returns multiple matches as a single group of matches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343331#M101669</link>
      <description>&lt;P&gt;OOPS. @somesoni2 got it right. I got my &lt;CODE&gt;mv&lt;/CODE&gt; commands mixed up when I submitted, and I didn't check my answer first. Gotta make sure I check things before I submit!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 16:44:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343331#M101669</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-09-20T16:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to count the results of a rex that returns multiple matches as a single group of matches?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343332#M101670</link>
      <description>&lt;P&gt;It works!  Thank everyone.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 17:13:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-the-results-of-a-rex-that-returns-multiple-matches/m-p/343332#M101670</guid>
      <dc:creator>bschaap</dc:creator>
      <dc:date>2017-09-20T17:13:50Z</dc:date>
    </item>
  </channel>
</rss>

