Splunk Search

subsearch query

brenisro
New Member

I have the following query that works fine.

index=pdv OrgId=* | rex field=request_id "SearchString=(?[^\d].*?)\|.*$" | search PatientName=* | rex field=PatientName "(?.*?)[ ,](?.*)" | rex field=client_id "UserId=(?\d+)" | lookup company_administration-user user_id OUTPUT user_name first_name AS u_first last_name AS u_last | table _time OrgId user_name u_first u_last p_first p_last

I want to add a subsearch that looks for all occurrences where p_last is within user_name. I don't know how to adjust the query to get this result - can anyone help please? In other words - user_name is an email address and p_last is a users last name. I want to know when a users last name is within the email address.

thank you.

Tags (1)
0 Karma

somesoni2
Revered Legend

Try adding following to end of your search

Your current search | eval HasLastNameInEmail=if(like(user_name,"%".p_last."%"),"Yes","No")
0 Karma

brenisro
New Member

Thank you very much - that works perfectly!!

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...