Splunk Search

How to filter the lookup output with the Where clause

kalibaba2021
Path Finder

Does the Lookup cmd allow for Where clause to filter the output of Lookup? Or do I need to have an extra sub search with | inputlookup  with the Where clause I need:

Ex of what I'd like to do:

| makeresults

| eval FullName = split("First1 Last1, First2 Last2, First3 Last3",",")

|mvexpand FullName

| lookup MyNamesFile.csv "emp_full_name" as FullName  OUTPUTNEW Phone as phone

``` HERE I WANT TO FILTER ON SPECIFIC criteria form the lookup file```

| where state="New York" and city="New York"

| mvexpand phone

 

In concept this is the type of filter I need. Obviously the above code doesn't work and I'd like to know what is the best way to achieve filtering out lookup output.

Labels (2)
0 Karma

kalibaba2021
Path Finder

yes, those fields are coming from the lookup file., and that makes sense. Thank you.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

It is not clear where state and city are coming from - if they are coming from the csv, they should be listed

| makeresults
| eval FullName = split("First1 Last1, First2 Last2, First3 Last3",",")
| mvexpand FullName
| lookup MyNamesFile.csv "emp_full_name" as FullName  OUTPUTNEW Phone as phone State as state City as city
| where state="New York" and city="New York"
| mvexpand phone
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...