Splunk Search

How to compare 2 different Fields between 2 lookups and output must be missing items

HPACHPANDE
Explorer

Lookup 1  : Contains fields such as  AssetName  FQDN and IP Address
Lookup 2 :  Contains fields such as Host Index and source type 

Expected Output : Need to compare host value from lookup 2 with FQDN and IP address in Lookup 1 and output must be missing devices details

Labels (1)
0 Karma

dtburrows3
Builder

If I correctly understood what you are asking for I was able to achieve it by doing this.

| inputlookup <lookup_2>
    ``` checking for match against host field from lookup_2 against the FQDN field in lookup_1 ```
    | lookup <lookup_1> FQDN as host OUTPUT FQDN as host_match
    ``` checking for match against host field from lookup_2 against the IP field in lookup_1 ```
    | lookup <lookup_1> IP as host OUTPUT IP as ip_match
    ``` coalesce the fqdn and ip matches into one field ```
    | eval
        asset_match=coalesce(host_match, ip_match)
    | fields - host_match, ip_match
    ``` filter off hosts that matches were found for ```
    | where isnull(asset_match)

 
Example of lookup_1:

dtburrows3_0-1703776342294.png

Example of lookup_2:

dtburrows3_1-1703776370502.png

Example of final output:

dtburrows3_2-1703776399991.png

You can see in the final output that the only 2 entries returned are ones who's host values do not have any matches against FQDN or IP in lookup_1.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...