<?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: Sum by Name Regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Sum-by-Name-Regex/m-p/463191#M130580</link>
    <description>&lt;P&gt;Try this query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo | rex "(?&amp;lt;location&amp;gt;[^\-]+?)-(?&amp;lt;storage&amp;gt;[^\-]+)-\d+, (?&amp;lt;size&amp;gt;\d+)" | stats sum(size) as TotalSize by location,storage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 18 Oct 2019 16:03:30 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2019-10-18T16:03:30Z</dc:date>
    <item>
      <title>Sum by Name Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-by-Name-Regex/m-p/463190#M130579</link>
      <description>&lt;P&gt;I've spent awhile messing around with this and can't get anything working.  I need to sum a list like this by Storage1 and Storage2 to get a total of each Storage*.  This is a much larger list in reality with a dozen or so different Storage#s, and Multiple locations.&lt;/P&gt;

&lt;P&gt;I'd imagine i need some type of regex where i can sum by  then sum by &lt;/P&gt;

&lt;P&gt;Location1-Storage1-1, 500GB&lt;BR /&gt;
Location1-Storage1-2, 250GB&lt;BR /&gt;
Location1-Storage1-3, 200GB&lt;BR /&gt;
Location2-Storage2-1, 100GB&lt;BR /&gt;
Location2-Storage2-2, 150GB&lt;BR /&gt;
Location2-Storage2-3, 150GB&lt;/P&gt;

&lt;P&gt;Desired Output:&lt;/P&gt;

&lt;P&gt;Storage1: 950GB&lt;BR /&gt;
Storage2: 400GB&lt;BR /&gt;
Location1: 950GB&lt;BR /&gt;
Location 2: 400GB&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 15:43:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-by-Name-Regex/m-p/463190#M130579</guid>
      <dc:creator>splunk219783</dc:creator>
      <dc:date>2019-10-18T15:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sum by Name Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-by-Name-Regex/m-p/463191#M130580</link>
      <description>&lt;P&gt;Try this query.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=foo | rex "(?&amp;lt;location&amp;gt;[^\-]+?)-(?&amp;lt;storage&amp;gt;[^\-]+)-\d+, (?&amp;lt;size&amp;gt;\d+)" | stats sum(size) as TotalSize by location,storage
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Oct 2019 16:03:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-by-Name-Regex/m-p/463191#M130580</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-10-18T16:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Sum by Name Regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sum-by-Name-Regex/m-p/463192#M130581</link>
      <description>&lt;P&gt;Thank you! This definitely got me on my way, i've got it working now. &lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2019 19:18:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sum-by-Name-Regex/m-p/463192#M130581</guid>
      <dc:creator>splunk219783</dc:creator>
      <dc:date>2019-10-18T19:18:24Z</dc:date>
    </item>
  </channel>
</rss>

