Getting Data In

How can I only display results where a field is in a table returned by another query

jacu86
Engager

I have data in two different applications. I need to get fields from one query to use as filters for another, like this:

 

 

 

app=app1 | rex field=environment_url "https:\/\/(?<app_name>.*)\.foo\.com" | where app_name in [ search app=app2  | table app_name ]

 

 

 

app2 has a field named app_name which I'm turning into a table. app1 doesn't have this field, but I'm creating and extracting it with a regex. 

I only want the app names from app1 if they exist in the table I'm creating from app2. This query isn't working for me, what can I do? Thank you for any help.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The where command does not support the IN operator (which must be in upper case, BTW).  You can use the in function with where or the IN operator with search.  However, since the IN operator is converted to a series of ORs under the covers and the subsearch will return a series of ORs, I recommend not using IN.

app=app1 | rex field=environment_url "https:\/\/(?<app_name>.*)\.foo\.com" | search [ search app=app2  | table app_name | format ]

 

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...