Splunk Search

ldapsearch after query: How do I run the ldapsearch on all users from the results obtained after the first search?

RubenElias
Loves-to-Learn Everything

Hii all...

Hope you can help me with two questions

1)Trying to create a query to find if the target user that set to "password never expirer" is a service user with using ldapsearch

main serch =                 index=microsoft-windows-dc EventID=4738 NewUacValue=0x210

I am trying  to run this ldapsearch on the results to remove  users with UserTypeName = service

| ldapsearch domain=default search="(sAMAccountName=user)" attrs="sAMAccountName,displayName,sn,UserTypeName"

How do I run the ldapsearch on all users from the results obtained after the first search ?

 

2. ldapsearch run only by admin , how to set Permissions to other roles to run ldapsearch 

Thanks ... 

Labels (1)
Tags (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

What field does the index search return that can be used to match sAMAcountName in ldapsearch?  Assuming microsoft-windows-dc index has a field userName for this purpose, and assuming that the search doesn't return too many events, you can run map to run ldapsearch for each output directly.

index=microsoft-windows-dc EventID=4738 NewUacValue=0x210
| map search="ldapsearch domain=default search=\"(sAMAccountName=$userName$)\" attrs=\"sAMAccountName,displayName,sn,UserTypeName\""

By default map limits to maxsearches to 10; you may need to set this higher if the main search returns more than 10 events.  If you are only interested in certain statistics, and stats reduces number of rows significantly, run stats first.

Your second question is really an application question.  You need to read the documentation of ldapsearch.

Tags (1)
0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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