Splunk Search

How to match index search results to CSV lookup

fdw
New Member

I have a search that returns information about usernames and their IP, machine name, etc.

I want to cross-reference a CSV lookup that has a list of usernames and then the search result would only show the results that match a username in the CSV.

This is what I have been working with so far, but it's not changing my query results.

index=dlp
[|inputlookup users.csv |fields username]
|table username, machine_name, ip_address

My CSV has 1 column labeled username with the fields containing the usernames.

0 Karma

woodcock
Esteemed Legend

That should work but may not scale well; try this:

index=dlp
| lookup users.csv username OUTPUT username AS MATCHED
| where isnotnull(MATCHED)
|table username, machine_name, ip_address
0 Karma

saurabh0912
Path Finder

Try below query:-
index=dlp
| join username
[|inputlookup users.csv |fields username]
|table username, machine_name, ip_address

I am assuming your outer result must have field with username.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

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 ...