<?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 group by field values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/group-by-field-values/m-p/130410#M184537</link>
    <description>&lt;P&gt;Hi! I'm a new user and have begun using this awesome tool. I've got a question about how to group things, below.&lt;BR /&gt;
Suppose I have a log file that has 2 options for the field host: host-a, host-b and 2 different users. The users are turned into a field by using the rex filed=_raw command.&lt;/P&gt;

&lt;P&gt;This command will tells how many times each user has logged on:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=spss earliest=-25h  "Login succeeded for user" | rex field=_raw ".*Login succeeded for user: (?.*)" | stats count by user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This command will tells how many times each user has logged into each server&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=spss earliest=-25h  "Login succeeded for user" | rex field=_raw ".*Login succeeded for user: (?.*)" | stats count by user host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It gives an output that looks something like the following:&lt;/P&gt;

&lt;P&gt;user..........host..........count&lt;/P&gt;

&lt;P&gt;user1........host-a..........2&lt;/P&gt;

&lt;P&gt;user2........host-b..........5&lt;/P&gt;

&lt;P&gt;user2........host-a..........3&lt;/P&gt;

&lt;P&gt;How can I modify the post to get a unique list of how many people have logged onto each host e.g.&lt;/P&gt;

&lt;P&gt;host..........count&lt;/P&gt;

&lt;P&gt;host-a............2&lt;/P&gt;

&lt;P&gt;host-b............1&lt;/P&gt;

&lt;P&gt;I essentially want to group by user, but am not sure of how to do that. Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Thu, 18 Sep 2014 13:39:21 GMT</pubDate>
    <dc:creator>Splunkster45</dc:creator>
    <dc:date>2014-09-18T13:39:21Z</dc:date>
    <item>
      <title>group by field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-by-field-values/m-p/130410#M184537</link>
      <description>&lt;P&gt;Hi! I'm a new user and have begun using this awesome tool. I've got a question about how to group things, below.&lt;BR /&gt;
Suppose I have a log file that has 2 options for the field host: host-a, host-b and 2 different users. The users are turned into a field by using the rex filed=_raw command.&lt;/P&gt;

&lt;P&gt;This command will tells how many times each user has logged on:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=spss earliest=-25h  "Login succeeded for user" | rex field=_raw ".*Login succeeded for user: (?.*)" | stats count by user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This command will tells how many times each user has logged into each server&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=spss earliest=-25h  "Login succeeded for user" | rex field=_raw ".*Login succeeded for user: (?.*)" | stats count by user host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It gives an output that looks something like the following:&lt;/P&gt;

&lt;P&gt;user..........host..........count&lt;/P&gt;

&lt;P&gt;user1........host-a..........2&lt;/P&gt;

&lt;P&gt;user2........host-b..........5&lt;/P&gt;

&lt;P&gt;user2........host-a..........3&lt;/P&gt;

&lt;P&gt;How can I modify the post to get a unique list of how many people have logged onto each host e.g.&lt;/P&gt;

&lt;P&gt;host..........count&lt;/P&gt;

&lt;P&gt;host-a............2&lt;/P&gt;

&lt;P&gt;host-b............1&lt;/P&gt;

&lt;P&gt;I essentially want to group by user, but am not sure of how to do that. Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2014 13:39:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-by-field-values/m-p/130410#M184537</guid>
      <dc:creator>Splunkster45</dc:creator>
      <dc:date>2014-09-18T13:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: group by field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/group-by-field-values/m-p/130411#M184538</link>
      <description>&lt;P&gt;Welcome Splunkster45,&lt;/P&gt;

&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=spss earliest=-25h  "Login succeeded for user" | rex field=_raw ".*Login succeeded for user: (?.*)" | stats count(user) AS count by host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 18 Sep 2014 13:43:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/group-by-field-values/m-p/130411#M184538</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-09-18T13:43:41Z</dc:date>
    </item>
  </channel>
</rss>

