Splunk Search

csvfile search in values

shrinivaskittur
Explorer

Hi,

I have csv file containing emailID and domain  and I would like to search the email exchanges between these two(emaild and domain)

Csv file looks like below 

emailID                                           domain

test1@company.com             abc.com

test2@company.com             xyz.com

test3@company.com             some.com

so on ..........

based on the above I need to check how many time the emails exchanged between emailID and domain, I tried with below query but unable to get the result

my search.... [| inputlookup test.csv | eval emailID = mvjoin(emailID ,",") | eval domain= "*@.".domain
| eval condition1 = "Sender IN (".domain.") AND Rcpt IN (".emailID .") " | return $condition1 ] | table Sender Rcpt

 

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The current query looks for two literal strings in the Sender and Rcpt fields, which explains why you don't get the expected results.  See if this helps.

your search.... [| inputlookup test.csv 
  | eval domain= "*@.".domain
  | fields email domain | rename email as Sender, domain as Rcpt | format ] 
| table Sender Rcpt
---
If this reply helps you, Karma would be appreciated.
0 Karma

shrinivaskittur
Explorer

Hi,

Please help me to get the correct query for my search.

0 Karma

shrinivaskittur
Explorer

Thank you for your reply, the suggested query is not giving me any outputs. If I select any one field I get one side result but when I select both fields "| fields email domain" then I won't get any result.


I want to achieve if any "EmailID" (listed in CSV) sends an email to any of the "domain"(listed in CSV) and vice versa should be shown in the search result.

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
your search.... [| inputlookup test.csv 
  | eval domain= "*@.".domain
  | fields domain | rename domain as Rcpt | format ] 
  [| inputlookup test.csv 
  | fields email | rename email as Sender | format ] 
| table Sender Rcpt
0 Karma

shrinivaskittur
Explorer

No Output from this query 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Sorry, there was a typo - try this

your search.... [| inputlookup test.csv 
  | eval domain= "*@".domain
  | fields domain | rename domain as Rcpt | format ] 
  [| inputlookup test.csv 
  | fields email | rename email as Sender | format ] 
| table Sender Rcpt
0 Karma

shrinivaskittur
Explorer

Hi,

Still the same, result is blank.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Perhaps there is a mismatch between your indexed data and your csv file, for example, space padding, case, etc. Have you tried using one of the values from the csv to see if you get any results

your search ... domain="*@abc.com"
0 Karma

shrinivaskittur
Explorer

Hi,

I have already did this testing, I have taken sender and recipient from the recent logs and did the search using the same query but still not getting the result.

 

As said, I need both fields from csv  to be matched in search (sender and recipient) for example.

if sender A sends email to recipient B and also if recipient B replies emails to sender B, in both case I should get the result . sender A & B are in csv should match.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Can you share your full search and some anonymised sample events?

0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...