Getting Data In

Compare .csv file data against indexed event data

thejamesvolta
Engager

I have a .csv file containing a list of email addresses (approximately 35k addresses/rows). I'm trying to compare the email addresses within the .csv, against email addresses in my events to see if we have ever delivered to one of these addresses.

Thanks!

Tags (1)
1 Solution

lguinn2
Legend

First, set up the CSV file as a lookup table. Instructions for lookups

Note that the first line of the CSV file must be a header. For my example, I assume that the lines of your CSV file look like this:

email
myaddress1@mydomain.com
timmy@downthewell.org

When you set up the lookup definition, choose Advanced Options. Set the minimum and maximum number of matches to 1. Set the default value to "unmatched". You need to do this so that you can easily determine if there is no match for an address. For my example, I assume that you named your lookup "email_lookup".

I will assume that your events contain a field called "to_email". This search should work:

searchforevents
| dedup to_email
| lookup email_lookup email as to_email OUTPUT email as matched_email
| where matched_email!="unmatched"

Note that I dedup-ed the events before searching for a match; this will reduce the number of lookups.

HTH - please post back if this doesn't work!

View solution in original post

siraj198204
Explorer

Hi,

index =casm_prod source =/opt/siteminder/log/smtracedefault.log sourcetype=smtrace supportcentral | rex "([[^]]]){10}[(?P[^]])]" | dedup sso_id | lookup identity_lookup sso as sso_id OUTPUT sso as matched_email | where matched_email!="unmatched"

this will work good ? ... i need the unmatched data with lookup table with my event ...

Thank u ..

0 Karma

lguinn2
Legend

First, set up the CSV file as a lookup table. Instructions for lookups

Note that the first line of the CSV file must be a header. For my example, I assume that the lines of your CSV file look like this:

email
myaddress1@mydomain.com
timmy@downthewell.org

When you set up the lookup definition, choose Advanced Options. Set the minimum and maximum number of matches to 1. Set the default value to "unmatched". You need to do this so that you can easily determine if there is no match for an address. For my example, I assume that you named your lookup "email_lookup".

I will assume that your events contain a field called "to_email". This search should work:

searchforevents
| dedup to_email
| lookup email_lookup email as to_email OUTPUT email as matched_email
| where matched_email!="unmatched"

Note that I dedup-ed the events before searching for a match; this will reduce the number of lookups.

HTH - please post back if this doesn't work!

thejamesvolta
Engager

This worked perfectly! Thank you!

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