<?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: Find unique person count in Splunk in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49070#M11758</link>
    <description>&lt;P&gt;mbenwell is right - the order of terms is not important. The search in my answer has three different and independent terms.&lt;/P&gt;</description>
    <pubDate>Sun, 03 Mar 2013 11:05:36 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2013-03-03T11:05:36Z</dc:date>
    <item>
      <title>Find unique person count in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49065#M11753</link>
      <description>&lt;P&gt;I've below line in my logs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;INFO #add-person# #new# personId=12 isGroupMember=true
INFO #remove-person# #remove# personId=1 isGroupMember=true
INFO #add-person# #new# personId=13 isGroupMember=false
INFO #add-person# #new# personId=12 isGroupMember=true
INFO #add-person# #new# personId=14 isGroupMember=true
INFO #add-person# #new# personId=15 isGroupMember=true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Log has all other lines as well which I did not show here.&lt;/P&gt;

&lt;P&gt;I need to write the query which will give me the count of all persons who are added newly &amp;amp; who are group members. So basically I'm looking for "#add-person# #new# isGroupMember=true" for unique personIds.&lt;/P&gt;

&lt;P&gt;For above input, the output should be 3 as there are 3 unique personIds with grupmembership set to true and who are having tag "#add-person# #new#"&lt;/P&gt;

&lt;P&gt;How can I do it with Splunk query?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 02 Mar 2013 02:36:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49065#M11753</guid>
      <dc:creator>freephoneid</dc:creator>
      <dc:date>2013-03-02T02:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Find unique person count in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49066#M11754</link>
      <description>&lt;P&gt;The first part of your search should be to match just the log events you are interested in (isGroupMember=true, add-person new...). &lt;/P&gt;

&lt;P&gt;Then look into the stats command&lt;/P&gt;</description>
      <pubDate>Sat, 02 Mar 2013 04:55:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49066#M11754</guid>
      <dc:creator>mbenwell</dc:creator>
      <dc:date>2013-03-02T04:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Find unique person count in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49067#M11755</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"#add-person#"  "#new#" isGroupMember=true
| stats dc(personId) as NewMembersCount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For more details, you could do this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"#add-person#"  "#new#" isGroupMember=true
| stats dc(personId) as NewMembersCount values(personId) as "New Member Ids"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Mar 2013 09:17:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49067#M11755</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-03-02T09:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Find unique person count in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49068#M11756</link>
      <description>&lt;P&gt;Hi, In your query, you're looking for "#add-person#"  "#new#" isGroupMember=true but I believe this first part itself will not return any results as the personId=&lt;PERSONID&gt; string is present in between. When we search in Splunk, it'll look for strings in order, right? If so, the first part itself won't return any results. Can you please comment?&lt;/PERSONID&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2013 07:54:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49068#M11756</guid>
      <dc:creator>freephoneid</dc:creator>
      <dc:date>2013-03-03T07:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Find unique person count in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49069#M11757</link>
      <description>&lt;P&gt;lguinn's search will return every record that contains #add-person#, #new# and has isGroupMember set to true. &lt;/P&gt;

&lt;P&gt;If you surrounded the entire string in quotes (i.e. "#add-person# #new# isGroupMember-true") then no, it wouldn't match anything, because it would literally search for that string.  But that is not what lguinn has given you.&lt;/P&gt;

&lt;P&gt;In lguinn's example, both strings have been quoted, so it will match each individual string regardless of order.&lt;/P&gt;

&lt;P&gt;If you're not sure if the search is right, run the search without the stats command and see what results you get back.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2013 08:42:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49069#M11757</guid>
      <dc:creator>mbenwell</dc:creator>
      <dc:date>2013-03-03T08:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Find unique person count in Splunk</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49070#M11758</link>
      <description>&lt;P&gt;mbenwell is right - the order of terms is not important. The search in my answer has three different and independent terms.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2013 11:05:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Find-unique-person-count-in-Splunk/m-p/49070#M11758</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2013-03-03T11:05:36Z</dc:date>
    </item>
  </channel>
</rss>

