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!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...