Splunk Search

Splunk query to create field which should be true or false if data field value available in lookup table.

Abhineet
Loves-to-Learn Everything

Hi

I am trying to create new column in table after extracting information from json data, new column have value "True" or "False" if "toDomain" column data available in  lookup table .

Querry: index="pps_index" sourcetype="pps_messagelog" "filter.routeDirection"=outbound |rex field=envelope.rcpts{} .*@(?<toDomain>.*)|rex field=envelope.from .*@(?<fromDomain>.*)|rename envelope.from as Sender envelope.rcpts{} as Recipient msg.header.subject as Subject msgParts{}.detectedName as Attachment | table Sender Recipient Subject Attachment toDomain

lookup file "publicDomain.csv" contains below data as example.

publicDomain
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
126.com
15meg4free.com
163.com
163.net
169.cc
188.net

current output:

Sender Recipient Subject
Attachment
toDomain
Ruotong_Yin@contractor.amat.comngarza@littelfuse.comRE: AMAT PO 4513405497 11.26.2021 Littelfuse Inc.
text.txt
text.html
lt po# 4513405497.pdf
littelfuse.com
Amanda_Mo@amat.comcod.b2b.servicerequest@my344310.mail.crm.ondemand.comRE: [ Ticket: 3018517 ] WF: WF: 25420987000020 & 25420672000020-- 0190-17499W * (1+1) =2EA--- pls create STO from 8665 & 8639 to 8602. thank you!
text.txt
text.html
image005.jpg
image006.png
image001.jpg
image002.jpg
image007.jpg
my344310.mail.crm.ondemand.com
Amanda_Mo@amat.comhfamat.list@bondex.com.cnRE: [ Ticket: 3018517 ] WF: WF: 25420987000020 & 25420672000020-- 0190-17499W * (1+1) =2EA--- pls create STO from 8665 & 8639 to 8602. thank you!
text.txt
text.html
image005.jpg
image006.png
image001.jpg
image002.jpg
image007.jpg
bondex.com.cn

 

tme@massgroup.com

tme@123box.netWork Order Past Due Notification: WO# 199996text.txt123box.net

 

Desired Output:

Sender Recipient Subject
Attachment
toDomainPDVal
Ruotong_Yin@contractor.amat.comngarza@littelfuse.comRE: AMAT PO 4513405497 11.26.2021 Littelfuse Inc.
text.txt
text.html
lt po# 4513405497.pdf
littelfuse.comFalse
Amanda_Mo@amat.comcod.b2b.servicerequest@my344310.mail.crm.ondemand.comRE: [ Ticket: 3018517 ] WF: WF: 25420987000020 & 25420672000020-- 0190-17499W * (1+1) =2EA--- pls create STO from 8665 & 8639 to 8602. thank you!
text.txt
text.html
image005.jpg
image006.png
image001.jpg
image002.jpg
image007.jpg
my344310.mail.crm.ondemand.comFalse
Amanda_Mo@amat.comhfamat.list@bondex.com.cnRE: [ Ticket: 3018517 ] WF: WF: 25420987000020 & 25420672000020-- 0190-17499W * (1+1) =2EA--- pls create STO from 8665 & 8639 to 8602. thank you!
text.txt
text.html
image005.jpg
image006.png
image001.jpg
image002.jpg
image007.jpg
bondex.com.cnFalse

 

tme@massgroup.com

tme@123box.netWork Order Past Due Notification: WO# 199996text.txt123box.netTrue

 

Kindly provide solution to resolve issue.

 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Add a second column to your csv file called PDVal and set all the rows to "True". After the lookup, you can fillnull value="False" PDVal to set all the unmatched to "False"

0 Karma

Abhineet
Loves-to-Learn Everything

Thanks for solution.. will try and check whether it works or not.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...