<?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: How to LDAPGROUP filter by MEMBER_TYPE? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651975#M225363</link>
    <description>&lt;P&gt;It turns out that there is a different, but closely related technique for getting to the same result, if all you are interested in is the narrow goal of listing AD group direct membership.&lt;/P&gt;&lt;P&gt;Instead of using LDAPGROUP, use the &lt;U&gt;LDAPFETCH&lt;/U&gt; function.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| ldapsearch search="(&amp;amp;(objectClass=Group)(cn=Remote Desktop Users)"
| mvexpand member
| ldapfetch dn=member attrs="cn"
| table cn&lt;/LI-CODE&gt;&lt;P&gt;This returns the direct members of the group using their CN or any alternate attribute.&lt;/P&gt;&lt;P&gt;It leaves me wondering what the best cases are for using the LDAPGROUP function.&amp;nbsp; The official documentation on it is fairly light and I was only able to find a small handful of examples online.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2023 18:26:57 GMT</pubDate>
    <dc:creator>ddetlef</dc:creator>
    <dc:date>2023-07-25T18:26:57Z</dc:date>
    <item>
      <title>How to LDAPGROUP filter by MEMBER_TYPE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651788#M225304</link>
      <description>&lt;P&gt;I am successfully using some simple LDAPSEARCH + LDAPGROUP searches to produce membership lists for various AD groups.&lt;/P&gt;
&lt;P&gt;Ex.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| ldapsearch search="(&amp;amp;(objectClass=Group)(cn=Remote Desktop Users)"
| table cn,distinguishedName
| ldapgroup
| table cn,member_name,member_type&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The searches work, but always show me all possible membership types (DIRECT, NESTED, etc.)&lt;/P&gt;
&lt;P&gt;I would like to filter my end results so that only DIRECT members are returned.&lt;/P&gt;
&lt;P&gt;I've tried inserting a | WHERE clause after the LDAPGROUP or final table command, but it just returns an empty set.&lt;/P&gt;
&lt;P&gt;I'm clearly not quite understanding how to pipeline output correctly.&amp;nbsp; Any help is much appreciated.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2023 17:44:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651788#M225304</guid>
      <dc:creator>ddetlef</dc:creator>
      <dc:date>2023-07-24T17:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to LDAPGROUP filter by MEMBER_TYPE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651791#M225306</link>
      <description>&lt;P&gt;What where command have you used?&amp;nbsp; It should be something like this.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| ldapsearch search="(&amp;amp;(objectClass=Group)(cn=Remote Desktop Users)"
| table cn,distinguishedName
| ldapgroup
| where member_type="DIRECT"
| table cn,member_name,member_type&lt;/LI-CODE&gt;&lt;P&gt;Have you tried a search command?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| ldapsearch search="(&amp;amp;(objectClass=Group)(cn=Remote Desktop Users)"
| table cn,distinguishedName
| ldapgroup
| search member_type="DIRECT"
| table cn,member_name,member_type&lt;/LI-CODE&gt;&lt;P&gt;If both of those fail then perhaps the ldapgroup command is unable to get the member_type information.&amp;nbsp; Try enabling logging to see what is happening.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| ldapsearch search="(&amp;amp;(objectClass=Group)(cn=Remote Desktop Users)"
| table cn,distinguishedName
| ldapgroup debug=1 logging_level=DEBUG
| table cn,member_name,member_type&lt;/LI-CODE&gt;&lt;P&gt;Then search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal source=*SA-ldapsearch.log&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 24 Jul 2023 18:10:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651791#M225306</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-07-24T18:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to LDAPGROUP filter by MEMBER_TYPE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651796#M225308</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;As I understand it, LDAPGROUP is what is generating the MEMBER_TYPE information.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/SA-LdapSearch/3.0.7/User/Theldapgroupcommand" target="_blank"&gt;https://docs.splunk.com/Documentation/SA-LdapSearch/3.0.7/User/Theldapgroupcommand&lt;/A&gt;&lt;/P&gt;&lt;P&gt;From your suggestions, I tried both&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;| ldapgroup | where member_type="DIRECT"&lt;/LI&gt;&lt;LI&gt;| ldapgroup | search member_type="DIRECT"&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;and both of them produce the same result as my original search - one nicely formatted row showing the group in one column and all of the group members in the other column - both DIRECT and NESTED.&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;cn&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;member_name&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;member_type&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%"&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Remote Desktop Users&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Finance&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Sales&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Fred&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Sam&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Joe&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Ted&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%"&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;DIRECT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;DIRECT&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;NESTED&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;NESTED&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;NESTED&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;NESTED&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My guess is that both SEARCH and WHERE are operating on the initial LDAPSEARCH operation. The group itself has matching member_type data.&amp;nbsp; The searches are all working, and nothing fails, so there doesn't appear to be anything illuminating in the debug log.&lt;/P&gt;&lt;P&gt;I imagine I could REGEX the field to delete the unwanted entries from the view, but that seems like an odd workaround since LDAPGROUP is producing member_type data.&lt;/P&gt;&lt;P&gt;I'm still &lt;EM&gt;just&lt;/EM&gt; shy of having this work.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2023 18:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651796#M225308</guid>
      <dc:creator>ddetlef</dc:creator>
      <dc:date>2023-07-24T18:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to LDAPGROUP filter by MEMBER_TYPE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651801#M225309</link>
      <description>&lt;P&gt;That table should have been in the OP since it clarifies the problem.&amp;nbsp; It appears that &lt;FONT face="courier new,courier"&gt;ldapgroup&lt;/FONT&gt; creates multivalue fields that standard where/search operators can't handle.&amp;nbsp; The solution is to expand the multivalue fields before filtering them.&amp;nbsp; To retain the relationship between member_name and member_type, we'll use &lt;FONT face="courier new,courier"&gt;mvzip&lt;/FONT&gt; to pair them up before expanding them.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| ldapsearch search="(&amp;amp;(objectClass=Group)(cn=Remote Desktop Users)"
| table cn,distinguishedName
| ldapgroup
``` Combine member_name and member_type
| eval member_name_type=mvzip(member_name, member_type, "#")
``` Put each member into a separate event ```
| mvexpand member_name_type
``` Break the member field apart again ```
| eval member_name_type = split(member_name_type, "#")
| eval member_name=mvindex(member_name_type,0), member_type=mvindex(member_name_type,1)
| where member_type="DIRECT"
| table cn,member_name,member_type&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2023 19:36:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651801#M225309</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-07-24T19:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to LDAPGROUP filter by MEMBER_TYPE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651966#M225359</link>
      <description>&lt;P&gt;Thank you very much for the coaching on the multivalue functions.&amp;nbsp; I had never used any of those before.&lt;/P&gt;&lt;P&gt;Your code suggestions for mvzip/mvexpand/mvindex worked exactly as described.&lt;/P&gt;&lt;P&gt;This solution has the advantage of being able to generalize to many other scenarios.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 18:13:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651966#M225359</guid>
      <dc:creator>ddetlef</dc:creator>
      <dc:date>2023-07-25T18:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to LDAPGROUP filter by MEMBER_TYPE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651974#M225362</link>
      <description>&lt;P&gt;If your problem is resolved, then please click the "Accept as Solution" button to help future readers.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 18:25:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651974#M225362</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-07-25T18:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to LDAPGROUP filter by MEMBER_TYPE?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651975#M225363</link>
      <description>&lt;P&gt;It turns out that there is a different, but closely related technique for getting to the same result, if all you are interested in is the narrow goal of listing AD group direct membership.&lt;/P&gt;&lt;P&gt;Instead of using LDAPGROUP, use the &lt;U&gt;LDAPFETCH&lt;/U&gt; function.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| ldapsearch search="(&amp;amp;(objectClass=Group)(cn=Remote Desktop Users)"
| mvexpand member
| ldapfetch dn=member attrs="cn"
| table cn&lt;/LI-CODE&gt;&lt;P&gt;This returns the direct members of the group using their CN or any alternate attribute.&lt;/P&gt;&lt;P&gt;It leaves me wondering what the best cases are for using the LDAPGROUP function.&amp;nbsp; The official documentation on it is fairly light and I was only able to find a small handful of examples online.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 18:26:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-LDAPGROUP-filter-by-MEMBER-TYPE/m-p/651975#M225363</guid>
      <dc:creator>ddetlef</dc:creator>
      <dc:date>2023-07-25T18:26:57Z</dc:date>
    </item>
  </channel>
</rss>

