<?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: Difference between users in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-users/m-p/706597#M239105</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/270694"&gt;@JandrevdM&lt;/a&gt;&amp;nbsp;as your search is doing the same search twice just with a different user, you'd be better off just doing a single search and splitting by user, e.g. - similar to your existing search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=db_assets sourcetype=assets_ad_users ($user1$ OR $user2$) 
| dedup displayName sAMAccountName memberOf 
| makemv delim="," memberOf 
| mvexpand memberOf 
| rex field=memberOf "CN=(?&amp;lt;Group&amp;gt;[^,]+)" 
| where Group!="" 
| stats values(Group) as Groups by user&lt;/LI-CODE&gt;&lt;P&gt;which will give you a user column and then a multivalue field with the list of groups&lt;/P&gt;&lt;P&gt;If you then want to automatically show the differences between the two users, you can following that with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transpose 0 header_field=user
| eval UniqueU1=mvmap(User1, if(User1!=User2,User1,null()))
| eval UniqueU2=mvmap(User2, if(User2!=User1,User2,null()))
| eval Common=mvmap(User1, if(User1=User2,User1,null()))&lt;/LI-CODE&gt;&lt;P&gt;and it will give you a list of groups unique to user 1, user 2 and the common groups.&lt;/P&gt;&lt;P&gt;However, your existing search could be more efficiently done with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=db_assets sourcetype=assets_ad_users ($user1$ OR $user2$) 
| fields displayName sAMAccountName memberOf
| stats latest(*) as * by user
| eval memberOf=split(memberOf,",")
| rex field=memberOf max_match=0 "CN=(?&amp;lt;Group&amp;gt;.+)"
| fields - memberOf&lt;/LI-CODE&gt;&lt;P&gt;If you really want a row by row breakdown of groups, you can do the base search and then just do this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| chart count over Group by user
| foreach * [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if("&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"="Group", &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, if('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'=1, "Member", "Missing")) ]&lt;/LI-CODE&gt;&lt;P&gt;which will tell you Membership status of each group per user&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2024 23:29:26 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2024-12-11T23:29:26Z</dc:date>
    <item>
      <title>Difference between users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-users/m-p/706548#M239087</link>
      <description>&lt;P&gt;Good day,&lt;BR /&gt;&lt;BR /&gt;I am trying to get a dashboard up and going to easily find the difference between two users groups. I get my information pulled from AD into splunk and then if user1 has a group that user2 doesnt have then I can easily compare two users to see what is missing. Example users in the same department typically require the same access but one might have more privileges and that is what I want to see.&lt;BR /&gt;&lt;BR /&gt;So my search works fine, only problem is it only gives me the group difference and now I cant see who has that group in order to add it to the user that doesnt have the group.&lt;BR /&gt;&lt;BR /&gt;I want to add the user next to the group:&lt;BR /&gt;example&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;group&lt;/TD&gt;&lt;TD width="50%"&gt;user&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;G-Google&lt;/TD&gt;&lt;TD width="50%"&gt;user1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;G-Splunk&lt;/TD&gt;&lt;TD width="50%"&gt;user2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;LI-CODE lang="markup"&gt;| set diff
    [ search index=db_assets sourcetype=assets_ad_users $user1$
    | dedup displayName sAMAccountName memberOf
    | makemv delim="," memberOf
    | mvexpand memberOf
    | rex field=memberOf "CN=(?&amp;lt;Group&amp;gt;[^,]+)"
    | where Group!=""
    | table Group ]
    [ search index=db_assets sourcetype=assets_ad_users $user2$
    | dedup displayName sAMAccountName memberOf
    | makemv delim="," memberOf
    | mvexpand memberOf
    | rex field=memberOf "CN=(?&amp;lt;Group&amp;gt;[^,]+)"
    | where Group!=""
    | table Group ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 14:42:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-users/m-p/706548#M239087</guid>
      <dc:creator>JandrevdM</dc:creator>
      <dc:date>2024-12-11T14:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-users/m-p/706562#M239088</link>
      <description>&lt;P&gt;That is the nature of the &lt;FONT face="courier new,courier"&gt;set diff&lt;/FONT&gt; command - it will tell there's a difference, but doesn't say what it is.&amp;nbsp; See &lt;A href="https://docs.splunk.com/Documentation/Splunk/9.3.2/SearchReference/Set" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/9.3.2/SearchReference/Set&lt;/A&gt;&lt;/P&gt;&lt;P&gt;An alternative would be to count the members of each group and show those with only one member.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| multisearch
    [ search index=db_assets sourcetype=assets_ad_users $user1$
    | dedup displayName sAMAccountName memberOf
    | makemv delim="," memberOf
    | mvexpand memberOf
    | rex field=memberOf "CN=(?&amp;lt;Group&amp;gt;[^,]+)"
    | where Group!=""
    | eval User=$user1$
    | table Group User ]
    [ search index=db_assets sourcetype=assets_ad_users $user2$
    | dedup displayName sAMAccountName memberOf
    | makemv delim="," memberOf
    | mvexpand memberOf
    | rex field=memberOf "CN=(?&amp;lt;Group&amp;gt;[^,]+)"
    | eval User=$user2$
    | where Group!=""
    | table Group User ]
| stats values(User) as Users by Group
| where mvcount(Users)=1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 15:49:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-users/m-p/706562#M239088</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2024-12-11T15:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between users</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Difference-between-users/m-p/706597#M239105</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/270694"&gt;@JandrevdM&lt;/a&gt;&amp;nbsp;as your search is doing the same search twice just with a different user, you'd be better off just doing a single search and splitting by user, e.g. - similar to your existing search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=db_assets sourcetype=assets_ad_users ($user1$ OR $user2$) 
| dedup displayName sAMAccountName memberOf 
| makemv delim="," memberOf 
| mvexpand memberOf 
| rex field=memberOf "CN=(?&amp;lt;Group&amp;gt;[^,]+)" 
| where Group!="" 
| stats values(Group) as Groups by user&lt;/LI-CODE&gt;&lt;P&gt;which will give you a user column and then a multivalue field with the list of groups&lt;/P&gt;&lt;P&gt;If you then want to automatically show the differences between the two users, you can following that with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transpose 0 header_field=user
| eval UniqueU1=mvmap(User1, if(User1!=User2,User1,null()))
| eval UniqueU2=mvmap(User2, if(User2!=User1,User2,null()))
| eval Common=mvmap(User1, if(User1=User2,User1,null()))&lt;/LI-CODE&gt;&lt;P&gt;and it will give you a list of groups unique to user 1, user 2 and the common groups.&lt;/P&gt;&lt;P&gt;However, your existing search could be more efficiently done with&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=db_assets sourcetype=assets_ad_users ($user1$ OR $user2$) 
| fields displayName sAMAccountName memberOf
| stats latest(*) as * by user
| eval memberOf=split(memberOf,",")
| rex field=memberOf max_match=0 "CN=(?&amp;lt;Group&amp;gt;.+)"
| fields - memberOf&lt;/LI-CODE&gt;&lt;P&gt;If you really want a row by row breakdown of groups, you can do the base search and then just do this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| chart count over Group by user
| foreach * [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=if("&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;"="Group", &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, if('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;'=1, "Member", "Missing")) ]&lt;/LI-CODE&gt;&lt;P&gt;which will tell you Membership status of each group per user&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 23:29:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Difference-between-users/m-p/706597#M239105</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-12-11T23:29:26Z</dc:date>
    </item>
  </channel>
</rss>

