Splunk Search

How can I use LDAPSearch to retrieve email based on selected specific CN

Joshie
New Member

Hi I have used ldapsearch to narrow down the list of members based on a specific CN:

e.g.
|ldapsearch domain="mydom" search="(&(objectclass=group)(|(CN=#R1231)(CN=#R31412)))" attrs="member"

The above will yield the list of identidies for each of the identified CN.

However, I wanted to use the above the pull more information about the individual identidies e.f. telephone, email, department etc.

I was hoping I can pipe it to another ldapsearch command but don't have any progress thus far.

Anyone has manage to do nested ldapsearch or have done what I was hoping to before?

Thanks for any help!

Tags (1)
0 Karma

ahall_splunk
Splunk Employee
Splunk Employee

You can easily nest things by using the other LDAP commands in the package. For example, using

|ldapsearch domain="X" search="(CN=#*)" attrs="distinguishedName"|ldapgroup

You get an expansion that actually shows the membership in a field called memberDN. You can expand this with ldapfetch:

|ldapsearch domain="X" search="(CN=#*)" attrs="distinguishedName"|ldapgroup|mvexpand memberdn|table cn,memberdn|ldapfetch dn=memberdn attrs="mail"|table cn,memberdn,mail

Check out the specific documentation within the SA-ldapsearch app, that has explicit examples for each of the four commands.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...