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!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...