Splunk Search

Why is Splunk search returning additional results not specified in Lookup table?

hillsmtb7
Explorer

I have a query to search particular event id's from Active Directory and see what Targets these apply to.  Instead of listing 100 different AD groups, I chose to use a lookup table.  My query is as follows:

index=<index name> EventID IN (4728,4729) TargetUserName IN
[| inputlookup Test_Splunk_Lookup_Table_v2.csv
| return 200 "$Group_Name"]
| eval EventID=case(EventID=="4728","Added",EventID=="4729","Removed")| rename Computer AS "Domain Controller",TargetUserName AS "Group",EventID AS "Action"| table "_time","SubjectUserName","Action","MemberName","Group","Domain Controller"

The search works well as long as the Group Names in the lookup tables are unique.  But if there is an entry in the lookup table that has derivatives(i.e. AD_Group), it returns all the derivatives also instead of what is in the lookup table only.

EX. Lookup Table

Group_Name column contains "AD_Group", "AD_Group_1", "AD_Group_2"

The search returns all the above groups plus additional groups not in the lookup table; AD_Group_3, AD_Group_4, etc...

I need to know how I can just return the entries in the list and not the derivatives of AD_Group.

Labels (2)
0 Karma
1 Solution

somesoni2
Revered Legend

Give this a try

index=<index name> EventID IN (4728,4729) TargetUserName IN
[| inputlookup Test_Splunk_Lookup_Table_v2.csv
| head 200 | rename Group_Name as search | table search | format "(" "" "" "" "" ")" ]
| eval EventID=case(EventID=="4728","Added",EventID=="4729","Removed")| rename Computer AS "Domain Controller",TargetUserName AS "Group",EventID AS "Action"| table "_time","SubjectUserName","Action","MemberName","Group","Domain Controller"

View solution in original post

hillsmtb7
Explorer

somesoni2 - Great Job....This worked.  Thank you!!!

0 Karma

somesoni2
Revered Legend

Give this a try

index=<index name> EventID IN (4728,4729) TargetUserName IN
[| inputlookup Test_Splunk_Lookup_Table_v2.csv
| head 200 | rename Group_Name as search | table search | format "(" "" "" "" "" ")" ]
| eval EventID=case(EventID=="4728","Added",EventID=="4729","Removed")| rename Computer AS "Domain Controller",TargetUserName AS "Group",EventID AS "Action"| table "_time","SubjectUserName","Action","MemberName","Group","Domain Controller"

somesoni2
Revered Legend

Does your lookup table data has any wildcard "*" in them? An actual example would be better.

0 Karma

hillsmtb7
Explorer
Group_Name
AD_Group
AD_Group_2
AD_Group_3
AD_Group_Addon
AD_Group_Test
AD_Group_Watch

 

This is the lookup table example.  The issue is with the first group since it brings back results for row 2 and 3 correctly, but also other groups that meet the beginning criterion "AD_Group" but are not part of the list.

My search without the first group produce 29 entries for the past 30 days; and correctly so.  But if I were to add the first line to the Lookup table, 800+ entries return because of the derivatives of the first part AD_Group.

0 Karma

hillsmtb7
Explorer

AD_Group_4, AD_Group_5, AD_Group_6, are not part of the list but show up because AD_Group is part of the lookup table.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...