Splunk Search

How can I display a matched value from a list.csv ?

packet_hunter
Contributor

For back ground please check the accepted answer for :
Best way to check email logs for recipients that are on a list

Scenario:
Searching for emails with a specific subject.
Need to know if any recipients are on a watch_list.csv (this has been accomplished by the following from somesoni2)
.... | lookup watch_list.csv emailaddress as recp OUTPUT flag | eval on_list=if(flag=1,"yes","no") | fields - flag ....

However, now I need the yes and the emailaddress that match the emailaddress on the watch_list.csv

Please provide an example.

Thank you

Tags (2)
0 Karma
1 Solution

somesoni2
Revered Legend

Just change your lookup command like this

..... | lookup watch_list.csv emailaddress as recp OUTPUT flag emailaddress | eval on_list=if(flag=1,"yes","no") | fields - flag 

View solution in original post

0 Karma

somesoni2
Revered Legend

Just change your lookup command like this

..... | lookup watch_list.csv emailaddress as recp OUTPUT flag emailaddress | eval on_list=if(flag=1,"yes","no") | fields - flag 
0 Karma

packet_hunter
Contributor

I knew you would come thru!!!! Thanks for all the help, I was adding emailaddress after the pipe... d'oh
Thanks again

0 Karma

packet_hunter
Contributor

um, is there a way to arrange the columns so that on_list column comes before emailaddress?

0 Karma

jluo_splunk
Splunk Employee
Splunk Employee

Are the email addresses stored in different field names? If so, try appending this to the end of your search

.. | where on_list="yes" AND  email1=email2
0 Karma

packet_hunter
Contributor

Thank you, however Somesoni2's answer actually works better for me.

0 Karma

packet_hunter
Contributor

in other words, I want to add the emailaddress to the yes output....

eval on_list=if(flag=1, "Yes" --and the matching emailaddress

Thank you

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

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