Getting Data In

How to match join on certain conditions within the inner search?

koshyk
Super Champion

I've got a specific requirement to fine tune a search. The search is something like..

 

<basesearch>
| fields other_fields,host,username
| join type=left host username [ `mycomplexmacro`| fields macro_fields,pci_flag,host,username]
| table *

 

 The issue I'm facing is if `pci_flag=no`, then I want to ensure the join does NOT include `host`, but if the `pci_flag=yes` I want to be strict and compare host && username. Unfortunately the `pci_flag` is not present in the <basesearch>, so the only way to determine is after the inner-search.

So essentially
I want the  search to turn to below style if `pci_flag=no` (See the host is not in join anymore)

 

| join type=left username [ `mycomplexmacro`| fields macro_fields,pci_flag,username]

 

I want the  search to turn to below style if `pci_flag=yes` (See the host present and strict)

 

| join type=left host username [ `mycomplexmacro`| fields macro_fields,pci_flag,host,username]

 

 

I tried options like below making,  but in vain

 

 eval host=if(pci_flag==no,"*",host)

 

 

Labels (1)
0 Karma
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...