Splunk Search

How do I join an index with a lookup?

Shashank_87
Explorer

Hi,

I need to join my query with a lookup which contains a field called username. I need to get the users who —

  1. exist in both my main query index and the lookup

  2. exist in lookup but do not exist in the main query index.

This is what my query looks like when i started writing this -

index="prod" sourcetype=prod_events 
| dedup username 
| eval type="MainIndex" 
| eval username = lower(username) 
| fields username type 
| appendpipe 
    [| inputlookup test.csv
    | eval type="lookup" 
    | eval username = lower(username) 
    | sort username
    | fields type username 
        ] 

Any help is appreciated. Many Thanks

0 Karma
1 Solution

Vijeta
Influencer

Add the below code to your search-

|stats dc(type) as dc ,values(type) as type by username | where NOT(dc=1 and type="MainIndex")

View solution in original post

0 Karma

Vijeta
Influencer

Add the below code to your search-

|stats dc(type) as dc ,values(type) as type by username | where NOT(dc=1 and type="MainIndex")
0 Karma
Get Updates on the Splunk Community!

Optimize Cloud Monitoring

  TECH TALKS Optimize Cloud Monitoring Tuesday, August 13, 2024  |  11:00AM–12:00PM PST   Register to ...

What's New in Splunk Cloud Platform 9.2.2403?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.2.2403! Analysts can ...

Stay Connected: Your Guide to July and August Tech Talks, Office Hours, and Webinars!

Dive into our sizzling summer lineup for July and August Community Office Hours and Tech Talks. Scroll down to ...