<?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 How to edit my search to return a list within a list? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-a-list-within-a-list/m-p/258824#M77561</link>
    <description>&lt;P&gt;Hey guys,&lt;/P&gt;

&lt;P&gt;So what i am trying to do is put a list inside of a list to get an output such as the one below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Comapny    |   Count1  |   Group  |  Count2   |  Environment  |  Count3
_____________________________________________________________________
CompanyID       10        GroupID1      2        Environment1      1
                                                 Environment2      1
                          GroupID2      8        Environment1      4
                                                 Environment2      4
______________________________________________________________________ 
CompanyID2      12        GroupID1      4        Environment1      3
                                                 Environment2      1
                          GroupID2      8        Environment1      2
                                                 Environment2      6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Comapny    |   Count1  |   Group  |  Count2   |  Environment1  |   Environment2
_______________________________________________________________________________________
CompanyID       10        GroupID1      2             1                  1
                          GroupID2      8             4                  4
_______________________________________________________________________________________
CompanyID2      12        GroupID1      4             3                  1
                          GroupID2      8             2                  6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have a search that gets me the Company, Group, and Environment but I can't get the counts and Groups to show up properly&lt;/P&gt;

&lt;P&gt;Current search:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="Customers" |stats count by Customer,Group, Environment |stats sum(count) as Total list(Group) as Source list(count) as Count list(Environment) as Environment list(count) as Count2 by Customer
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That search gets me the following output&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Comapny    |   Count1  |   Group  |  Count2   |  Environment  |  Count3
_____________________________________________________________________
CompanyID       10        GroupID1               Environment1      1
                          GroupID1               Environment2      1
                          GroupID2               Environment1      4
                          GroupID2               Environment2      4
______________________________________________________________________ 
CompanyID2      12        GroupID1               Environment1      3
                          GroupID1               Environment2      1
                          GroupID2               Environment1      2
                          GroupID2               Environment2      6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How would i get one of the two outputs from above?&lt;/P&gt;

&lt;P&gt;Thanks in advanced! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 19 May 2016 15:58:09 GMT</pubDate>
    <dc:creator>singhh4</dc:creator>
    <dc:date>2016-05-19T15:58:09Z</dc:date>
    <item>
      <title>How to edit my search to return a list within a list?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-a-list-within-a-list/m-p/258824#M77561</link>
      <description>&lt;P&gt;Hey guys,&lt;/P&gt;

&lt;P&gt;So what i am trying to do is put a list inside of a list to get an output such as the one below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Comapny    |   Count1  |   Group  |  Count2   |  Environment  |  Count3
_____________________________________________________________________
CompanyID       10        GroupID1      2        Environment1      1
                                                 Environment2      1
                          GroupID2      8        Environment1      4
                                                 Environment2      4
______________________________________________________________________ 
CompanyID2      12        GroupID1      4        Environment1      3
                                                 Environment2      1
                          GroupID2      8        Environment1      2
                                                 Environment2      6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Comapny    |   Count1  |   Group  |  Count2   |  Environment1  |   Environment2
_______________________________________________________________________________________
CompanyID       10        GroupID1      2             1                  1
                          GroupID2      8             4                  4
_______________________________________________________________________________________
CompanyID2      12        GroupID1      4             3                  1
                          GroupID2      8             2                  6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have a search that gets me the Company, Group, and Environment but I can't get the counts and Groups to show up properly&lt;/P&gt;

&lt;P&gt;Current search:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="Customers" |stats count by Customer,Group, Environment |stats sum(count) as Total list(Group) as Source list(count) as Count list(Environment) as Environment list(count) as Count2 by Customer
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That search gets me the following output&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Comapny    |   Count1  |   Group  |  Count2   |  Environment  |  Count3
_____________________________________________________________________
CompanyID       10        GroupID1               Environment1      1
                          GroupID1               Environment2      1
                          GroupID2               Environment1      4
                          GroupID2               Environment2      4
______________________________________________________________________ 
CompanyID2      12        GroupID1               Environment1      3
                          GroupID1               Environment2      1
                          GroupID2               Environment1      2
                          GroupID2               Environment2      6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How would i get one of the two outputs from above?&lt;/P&gt;

&lt;P&gt;Thanks in advanced! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2016 15:58:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-a-list-within-a-list/m-p/258824#M77561</guid>
      <dc:creator>singhh4</dc:creator>
      <dc:date>2016-05-19T15:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return a list within a list?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-a-list-within-a-list/m-p/258825#M77562</link>
      <description>&lt;P&gt;Give this a try (for expected format#2)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="Customers" |stats count by Customer,Group, Environment | eval temp=Customer."#".Group | xyseries temp Environment count
| addtotals fieldname=Count2 | rex field=temp "(?&amp;lt;Customer&amp;gt;[^#]+)#(?&amp;lt;Group&amp;gt;.+)" | fields - temp | stats sum(Count2) as Count1 list(*) as * by Customer
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 May 2016 16:43:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-a-list-within-a-list/m-p/258825#M77562</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-19T16:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to return a list within a list?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-a-list-within-a-list/m-p/258826#M77563</link>
      <description>&lt;P&gt;You are awesome! Thank you soo much!&lt;/P&gt;</description>
      <pubDate>Fri, 20 May 2016 16:53:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-return-a-list-within-a-list/m-p/258826#M77563</guid>
      <dc:creator>singhh4</dc:creator>
      <dc:date>2016-05-20T16:53:19Z</dc:date>
    </item>
  </channel>
</rss>

