<?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: Classify results into a defined group in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140400#M38782</link>
    <description>&lt;P&gt;Turns out I found out my own answer.&lt;/P&gt;

&lt;P&gt;You have to query the results and save it as an &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ClassifyAndGroupSimilarEvents#Save_a_search_as_a_new_event_type"&gt;event type&lt;/A&gt; and tag it with a common name.&lt;/P&gt;

&lt;P&gt;And you can display the groups by using the following command (assuming tag name is "owasp"):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search&amp;gt; tag::eventtype=owasp | stats count by eventtype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 06 Dec 2014 09:21:35 GMT</pubDate>
    <dc:creator>tayyujie</dc:creator>
    <dc:date>2014-12-06T09:21:35Z</dc:date>
    <item>
      <title>Classify results into a defined group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140395#M38777</link>
      <description>&lt;P&gt;I need to group results and give it another name as a result.&lt;/P&gt;

&lt;P&gt;For example, I have the following fruits and the number of fruits:&lt;BR /&gt;
apples 6&lt;BR /&gt;
oranges 4&lt;BR /&gt;
grapes 9&lt;BR /&gt;
watermelons 7&lt;BR /&gt;
pineapples 5&lt;/P&gt;

&lt;P&gt;I would like to group them according to their sizes:&lt;BR /&gt;
small 9 (consists of grapes)&lt;BR /&gt;
medium 10 (consists of apples and oranges)&lt;BR /&gt;
large 12 (consists of watermelons and pineapples)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Edit: I think my previous question is not an accurate representation of how I want my results to look like.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Let me provide another example:&lt;BR /&gt;
I have the following list: &lt;BR /&gt;
Parameter Tampering 10&lt;BR /&gt;
SQL Injection 15&lt;BR /&gt;
Stealth Commanding 20&lt;BR /&gt;
URL Access Control 5&lt;BR /&gt;
Unicode Directory Traversal 25&lt;/P&gt;

&lt;P&gt;I need to group them according to the OWASP 2013 list:&lt;BR /&gt;
Injection (consists of Parameter Tampering, SQL Injection, and Stealth Commanding and etc) 45&lt;BR /&gt;
Cross Site Scripting (consists of Cross Site Scripting) 0&lt;BR /&gt;
Insecure Direct Object References (consists of Parameter Tampering, Unicode Directory Traversal, and Stealth Commanding and etc) 55&lt;BR /&gt;
Missing Function Level Access Control (consists of Unicode Directory Traversal and etc) 25&lt;BR /&gt;
Cross Site Request Forgery (consists of Cross Site Scripting and Stealth Commanding) 20&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;There are repeated items that I need to group too, so eval case does not work in my case.&lt;/P&gt;

&lt;P&gt;I also want to display all the groups, even though they do not return a result.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Nov 2014 01:54:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140395#M38777</guid>
      <dc:creator>tayyujie</dc:creator>
      <dc:date>2014-11-30T01:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Classify results into a defined group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140396#M38778</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| eval size=case(fruit=="apples" OR fruit=="oranges","medium",
                 fruit=="grapes","small",
                 fruit=="watermelons" OR fruit=="pineapples","large",
                 1==1,"unknown")
| stats sum(numberFruits) as TotalFruits by size
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;assuming the relevant fields are called &lt;CODE&gt;fruit&lt;/CODE&gt; and &lt;CODE&gt;numberFruits&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Update: if you want to add the list of fruits, as suggested by @martin_mueller below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;yoursearchhere
| eval size=case(fruit=="apples" OR fruit=="oranges","medium",
                 fruit=="grapes","small",
                 fruit=="watermelons" OR fruit=="pineapples","large",
                 1==1,"unknown")
| stats sum(numberFruits) as TotalFruits values(fruit) as TypesofFruit by size
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 30 Nov 2014 08:08:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140396#M38778</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-11-30T08:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Classify results into a defined group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140397#M38779</link>
      <description>&lt;P&gt;Thank you very much! Just wondering if there's any way to enforce displaying of the groups in the search results?&lt;/P&gt;</description>
      <pubDate>Sun, 30 Nov 2014 11:11:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140397#M38779</guid>
      <dc:creator>tayyujie</dc:creator>
      <dc:date>2014-11-30T11:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Classify results into a defined group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140398#M38780</link>
      <description>&lt;P&gt;You could add &lt;CODE&gt;values(fruit)&lt;/CODE&gt; to the &lt;CODE&gt;stats&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Nov 2014 15:17:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140398#M38780</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-11-30T15:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Classify results into a defined group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140399#M38781</link>
      <description>&lt;P&gt;I'm sorry for the mixup, but for the search, it is mandatory for me to display the sizes of the fruits, not the group details.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Dec 2014 03:35:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140399#M38781</guid>
      <dc:creator>tayyujie</dc:creator>
      <dc:date>2014-12-01T03:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Classify results into a defined group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140400#M38782</link>
      <description>&lt;P&gt;Turns out I found out my own answer.&lt;/P&gt;

&lt;P&gt;You have to query the results and save it as an &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ClassifyAndGroupSimilarEvents#Save_a_search_as_a_new_event_type"&gt;event type&lt;/A&gt; and tag it with a common name.&lt;/P&gt;

&lt;P&gt;And you can display the groups by using the following command (assuming tag name is "owasp"):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search&amp;gt; tag::eventtype=owasp | stats count by eventtype
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 06 Dec 2014 09:21:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Classify-results-into-a-defined-group/m-p/140400#M38782</guid>
      <dc:creator>tayyujie</dc:creator>
      <dc:date>2014-12-06T09:21:35Z</dc:date>
    </item>
  </channel>
</rss>

