Splunk Search

how to assign an eval statement to matches on a subsearch?

virex
Engager

I have a main search and a lookup table
I want to assign field called isCorrect to values from the main search that matches the lookup table

it would look something like this

<main search>
| eval isCorrect = if(<found in lookup> , "true", "false")

however i am not sure how to form the logic for the boolean statement in the if statement

for now my boolean statement looks like
[|inputlookup lookup.csv| fields match]

Tags (3)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

A subsearch won't work there. You should consult the lookup table for each event and test for correctness. Something like this:

<main search>
| lookup lookup.csv <some field from the event> output <some field from the lookup>
| eval isCorrect = if(isnull(<some field from the lookup>, "false", "true")
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

A subsearch won't work there. You should consult the lookup table for each event and test for correctness. Something like this:

<main search>
| lookup lookup.csv <some field from the event> output <some field from the lookup>
| eval isCorrect = if(isnull(<some field from the lookup>, "false", "true")
---
If this reply helps you, Karma would be appreciated.
0 Karma

virex
Engager

Great it works for me!

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...