<?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: Sort and Grouping Question in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18751#M2762</link>
    <description>&lt;P&gt;Not very nice, but you can group the COMMAND and USER on a single columns and try the commands values().&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;mysearch | eval command_user= COMMAND." ".USER &lt;BR /&gt;
| stats values(command_user)  AS list_command_user by host&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;But the duplicates will be removed, so if you really need the count, add some magic.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;mysearch | eval command_user= COMMAND." ".USER &lt;BR /&gt;
| stats count  by command_user host &lt;BR /&gt;
| eval command_user_count=command_user." [".count."]"&lt;BR /&gt;
| stats values(command_user_count) AS list_command_user_count by host&lt;/CODE&gt; &lt;/P&gt;</description>
    <pubDate>Mon, 04 Feb 2013 16:09:36 GMT</pubDate>
    <dc:creator>yannK</dc:creator>
    <dc:date>2013-02-04T16:09:36Z</dc:date>
    <item>
      <title>Sort and Grouping Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18749#M2760</link>
      <description>&lt;P&gt;Hi Splunkers,&lt;/P&gt;

&lt;P&gt;this might sound stupid. I am trying to query and table host, COMMAND and USER which works fine. But is it possible to group the host? I want to display each COMMAND and USER value under one host name.&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;
Host                      COMMAND   USER&lt;BR /&gt;
&lt;A href="http://www.off.dus.acompany.com" target="_blank"&gt;www.off.dus.acompany.com&lt;/A&gt;  ini_t     root&lt;BR /&gt;
                          kthreadt  root&lt;BR /&gt;
                          ksoftirqd root&lt;BR /&gt;
                          migration root&lt;BR /&gt;
                          watdog/0  root&lt;BR /&gt;
                          mirtion/1 root&lt;BR /&gt;
                          ksoftqd/1 root&lt;BR /&gt;
&lt;A href="http://www.off.ber.bcompany.com" target="_blank"&gt;www.off.ber.bcompany.com&lt;/A&gt;  ini_t     root&lt;BR /&gt;
                          kthreadt  root&lt;BR /&gt;
                          ksoftirqd root&lt;BR /&gt;
                          migration root&lt;BR /&gt;
                          watdog/0  root&lt;BR /&gt;
                          mirtion/1 root&lt;BR /&gt;
                          ksoftqd/1 root&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;This is all I got &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=pu OR sourcetype=tik COMMAND | multikv | table host COMMAND USER&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In terms of visuals it is almost the same case as the following link &lt;/P&gt;

&lt;P&gt;&lt;A href="http://splunk-base.splunk.com/answers/25102/question-regarding-grouping-of-results-into-a-table" target="_blank"&gt;http://splunk-base.splunk.com/answers/25102/question-regarding-grouping-of-results-into-a-table &lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;

&lt;P&gt;Best regards&lt;BR /&gt;
Mike&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:13:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18749#M2760</guid>
      <dc:creator>lemikg</dc:creator>
      <dc:date>2020-09-28T13:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sort and Grouping Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18750#M2761</link>
      <description>&lt;P&gt;Perhaps mvcombine could be used? &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Mvcombine"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Mvcombine&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2013 16:08:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18750#M2761</guid>
      <dc:creator>MHibbin</dc:creator>
      <dc:date>2013-02-04T16:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sort and Grouping Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18751#M2762</link>
      <description>&lt;P&gt;Not very nice, but you can group the COMMAND and USER on a single columns and try the commands values().&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;mysearch | eval command_user= COMMAND." ".USER &lt;BR /&gt;
| stats values(command_user)  AS list_command_user by host&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;But the duplicates will be removed, so if you really need the count, add some magic.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;mysearch | eval command_user= COMMAND." ".USER &lt;BR /&gt;
| stats count  by command_user host &lt;BR /&gt;
| eval command_user_count=command_user." [".count."]"&lt;BR /&gt;
| stats values(command_user_count) AS list_command_user_count by host&lt;/CODE&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2013 16:09:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18751#M2762</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2013-02-04T16:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Sort and Grouping Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18752#M2763</link>
      <description>&lt;P&gt;thanks, i copy&amp;amp;pasted eval command_user= COMMAND." ".USER &lt;BR /&gt;
| stats values(command_user)  AS list_command_user by host. But it shows only the hosts. Is there anything I need to do else?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:13:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18752#M2763</guid>
      <dc:creator>lemikg</dc:creator>
      <dc:date>2020-09-28T13:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sort and Grouping Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18753#M2764</link>
      <description>&lt;P&gt;| stats list() will keep duplicate user-command tuples.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=pu OR sourcetype=tik COMMAND 
| multikv  
| strcat "[" USER "] " COMMAND user_command
| stats list(user_command) by host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Feb 2013 21:34:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18753#M2764</guid>
      <dc:creator>Paolo_Prigione</dc:creator>
      <dc:date>2013-02-04T21:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sort and Grouping Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18754#M2765</link>
      <description>&lt;P&gt;Perfect! Thank you very much!!!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2013 08:16:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18754#M2765</guid>
      <dc:creator>lemikg</dc:creator>
      <dc:date>2013-02-05T08:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Sort and Grouping Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18755#M2766</link>
      <description>&lt;P&gt;btw how do I now count the values in the field list(user_command)?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Feb 2013 08:43:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18755#M2766</guid>
      <dc:creator>lemikg</dc:creator>
      <dc:date>2013-02-05T08:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sort and Grouping Question</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18756#M2767</link>
      <description>&lt;P&gt;replace "| stats list(user_command) by host" with "| stats list(user_command) count dc(user_command) as distinct_count  by host"&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 13:14:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Sort-and-Grouping-Question/m-p/18756#M2767</guid>
      <dc:creator>Paolo_Prigione</dc:creator>
      <dc:date>2020-09-28T13:14:05Z</dc:date>
    </item>
  </channel>
</rss>

