<?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 merge and group multiple key-value pairs, count the values, and table the results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135643#M37093</link>
    <description>&lt;P&gt;Thanks for this. ES2=-150 and -250 is missing, how i can i group them too?&lt;/P&gt;</description>
    <pubDate>Mon, 22 Sep 2014 21:33:51 GMT</pubDate>
    <dc:creator>mkrauss1</dc:creator>
    <dc:date>2014-09-22T21:33:51Z</dc:date>
    <item>
      <title>How to merge and group multiple key-value pairs, count the values, and table the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135641#M37091</link>
      <description>&lt;P&gt;I try hard to group multiple key/values from a single record, then count the values and print them in a table.&lt;BR /&gt;
Say i have this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;EC1=1 ES1=-100 EC2=1 ES2=-150
EC1=1 ES1=-100 EC2=1 ES2=-150
EC1=2 ES1=-100 EC2=2 ES2=-150
EC1=2 ES1=-100 EC2=3 ES2=-150
EC1=1 ES1=-200 EC2=1 ES2=-250
EC1=2 ES1=-200 EC2=2 ES2=-250
EC1=2 ES1=-200 EC2=2 ES2=-250
EC1=2 ES1=-200 EC2=3 ES2=-250
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Means:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;ES1/2 are status codes&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;EC2/1 are counter values&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Now i'd like to group them into summaries, ES (ErrorStatus) and EC (Error Count).&lt;BR /&gt;
Trying to get:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Status    Count&lt;BR /&gt;
-100&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp6&lt;BR /&gt;
-150&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp7&lt;BR /&gt;
-200&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp6&lt;BR /&gt;
-250&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp&amp;amp;nbsp7&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I'd try to start with the stats and count function&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;|  stats count as Total count(ES1) as ESS1 count sum(EC1) as ECC1  count(ES2) as ESS2 count sum(EC2) as ECC2  by ES1,ES2&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;But that doesnt take me any further, any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 20:06:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135641#M37091</guid>
      <dc:creator>mkrauss1</dc:creator>
      <dc:date>2014-09-22T20:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and group multiple key-value pairs, count the values, and table the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135642#M37092</link>
      <description>&lt;P&gt;The easiest way to do this is with a subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=your_index sourcetype=your_sourcetype | stats sum(EC1) as count by ES1 | rename ES1 AS Status | append [ search index=your_index sourcetype=your_sourcetype | stats sum(EC2) as count by ES2 | rename ES2 AS Status]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Sep 2014 21:26:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135642#M37092</guid>
      <dc:creator>ShaneNewman</dc:creator>
      <dc:date>2014-09-22T21:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and group multiple key-value pairs, count the values, and table the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135643#M37093</link>
      <description>&lt;P&gt;Thanks for this. ES2=-150 and -250 is missing, how i can i group them too?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 21:33:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135643#M37093</guid>
      <dc:creator>mkrauss1</dc:creator>
      <dc:date>2014-09-22T21:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and group multiple key-value pairs, count the values, and table the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135644#M37094</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; you base search | rex max_match=0 "EC\d+=(?&amp;lt;EC&amp;gt;[^ ]+)" | rex max_match=0 "ES\d+=(?&amp;lt;Status&amp;gt;[^ ]+)" | table EC Status | eval temp=mvzip(EC,Status ,"#") | table temp | mvexpand temp | rex field=temp "(?&amp;lt;EC&amp;gt;.*)#(?&amp;lt;Status&amp;gt;.*)" | fields - temp | stats sum(EC) as Count by Status
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Sep 2014 22:42:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135644#M37094</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-09-22T22:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and group multiple key-value pairs, count the values, and table the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135645#M37095</link>
      <description>&lt;P&gt;That is strange, they are showing up in my search... Do you see ES2 values being extracted on the right hand side under interesting fields?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Sep 2014 22:50:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135645#M37095</guid>
      <dc:creator>ShaneNewman</dc:creator>
      <dc:date>2014-09-22T22:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge and group multiple key-value pairs, count the values, and table the results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135646#M37096</link>
      <description>&lt;P&gt;Wow, that's a tough query, thanks for this!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Sep 2014 10:32:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-merge-and-group-multiple-key-value-pairs-count-the-values/m-p/135646#M37096</guid>
      <dc:creator>mkrauss1</dc:creator>
      <dc:date>2014-09-23T10:32:49Z</dc:date>
    </item>
  </channel>
</rss>

