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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...