Getting Data In

How can I use a CSV of email addresses to search indexed data?

swright95
New Member

Hi everyone,

I'm having a little trouble querying with a CSV and wondered if you could provide assistance.

I have a CSV with a lot of email addresses:

Layout of Emails.csv

Emails
Email1@address.com
Email2@address.com
Email3@address.com

and so forth.

The query I'm using is:

index=index1 sourcetype=MessageTracking | search  [|inputlookup Emails.csv | rename Emails as address | fields address ] | table address, directionality

directionality is a field in the sourcetype MessageTracking. Unfortunately I am getting no results out of the query, although there are addresses in that sourcetype and the csv which I've queried and do get results back for.

Any help would be appreciated.

Thanks

Steve

0 Karma
1 Solution

DalJeanis
Legend

The first thing to do is check the spelling and capitalization of the field name for the email addresses. The field names must be spelled exactly like Emails in the csv, and address in index1.

Your subsearch will resolve into a string that looks like this:

( (  address="Email1@address.com" ) OR ( address="Email2@address.com") OR ...  )

If the field name is not exactly correct, then that will, of course, find nothing.


The second thing to do is run this...

index=index1 sourcetype=MessageTracking 
| search  [| inputlookup Emails.csv | rename Emails as address | table address ] 
| table address, directionality

That should have no different effect, since there should not be any extra hidden fields from an inputlookup, but if it solves something, then we'll figure out why it did.


The third thing is to try this...

index=index1 sourcetype=MessageTracking 
| search  [| makeresults | eval address="Email1@address.com" | table address ] 
| table address, directionality

If that doesn't work for you, then, again, there is something wrong with the field name or the data.

View solution in original post

0 Karma

DalJeanis
Legend

The first thing to do is check the spelling and capitalization of the field name for the email addresses. The field names must be spelled exactly like Emails in the csv, and address in index1.

Your subsearch will resolve into a string that looks like this:

( (  address="Email1@address.com" ) OR ( address="Email2@address.com") OR ...  )

If the field name is not exactly correct, then that will, of course, find nothing.


The second thing to do is run this...

index=index1 sourcetype=MessageTracking 
| search  [| inputlookup Emails.csv | rename Emails as address | table address ] 
| table address, directionality

That should have no different effect, since there should not be any extra hidden fields from an inputlookup, but if it solves something, then we'll figure out why it did.


The third thing is to try this...

index=index1 sourcetype=MessageTracking 
| search  [| makeresults | eval address="Email1@address.com" | table address ] 
| table address, directionality

If that doesn't work for you, then, again, there is something wrong with the field name or the data.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...