On Tuesday, I introduced one of the first presentations at .conf2014 – a major update to the SA-ldapsearch app. This new app has now launched and you can download it at http://apps.splunk.com/app/1151/. The app consists of four specific commands: ldapsearch, ldapfetch, ldapfilter and ldapgroup.
Improvements include:
The ldapsearch command is a generating command and is used in a similar way to other generating commands like inputlookup. You run it like this:
| ldapsearch domain=SPL search="(objectClass=user)" attrs="sAMAccountName,cn"
We have added some new features in this release. Firstly, the output is in JSON, so it’s a better format when you are looking at the raw events that come back. Secondly, you can search a subset of the data using the basedn and scope parameters. Let’s say all your users are in the ou=People container and it’s flat. You can optimize the above search like this:
| ldapsearch domain=SPL basedn="ou=People,dc=spl,dc=com" scope="sub" search="(objectClass=user)"
Of course, we kept the decoding of the attributes like the objectSID and other features you know and love.
If you want to augment the events you already have then you can use ldapfetch and ldapfilter. ldapfetch takes a distinguished name and fetches the object from Active Directory. ldapfilter uses fields to do a search. For example, let’s say you have an eventtype that has fields src_user and nt_domain (standard fields from the Common Information Model) and you want to add the persons real name and telephone number:
eventtype=my-event | stats count by src_user,nt_domain | ldapfilter domain=$nt_domain$ search="(sAMAccountName=$src_user$)" attrs="cn,telephoneNumber" | table src_user, nt_domain, cn, telephoneNumber
If that eventtype has a field called dn in it and the field contains the distinguished name of the object, we can do the same thing with ldapfetch:
eventtype=my-event | stats count by dn | ldapfetch dn=dn attrs="sAMAccountName,cn,telephoneNumber" | table sAMAccountName, cn, telephoneNumber
The final one is ldapgroup. This takes a distinguished name of a group and expands that group to the membership, taking into account nested groups and cyclical groups. It adds five multi-value fields to the event to provide information about the membership, including if they are listed in the group directly or indirectly via another group. You use it like this:
| ldapsearch domain=SPL search="(objectClass=group)" attrs="cn,distinguishedName" | ldapgroup | table cn,member_name,member_type
Hopefully, this new upgrade to our popular integration with Active Directory will help you with your reports. If you like this app, then perhaps you should also check out the Splunk App for Windows Infrastructure and monitor your Active Directory environment as well.
The Splunk platform removes the barriers between data and action, empowering observability, IT and security teams to ensure their organizations are secure, resilient and innovative.
Founded in 2003, Splunk is a global company — with over 7,500 employees, Splunkers have received over 1,020 patents to date and availability in 21 regions around the world — and offers an open, extensible data platform that supports shared data across any environment so that all teams in an organization can get end-to-end visibility, with context, for every interaction and business process. Build a strong data foundation with Splunk.