Splunk Search

How to find comman value from multiple watchlist

akshayinnamuri
Loves-to-Learn Lots

Hi 
below is one of the requirement

I have multiple lookuptable

example 

number  name   lookuptable

1               abc       1stlookuptable

 

number  name     lookuptable

1               abc       2ndlookuptable

 

number  name    lookuptable

1               dxc       3rdlookuptable

 

number  name    lookuptable

1               xyz       4thlookuptable

 

number  name    lookuptable

1               abc       5thlookuptable

 

requirement is how to build query where name=abc (from above example) to shows below table fields stating abc belong to which lookuptable on run

name lookuptable

 

example out

name  lookuptable

abc       1stlookuptable

               2ndlookuptable

               5thlookuptable

Labels (5)
Tags (2)
0 Karma

harishalipaka
Motivator

@akshayinnamuri 

 

Values - without duplicate , list - with duplicates 

 

| makeresults| eval lookupname="1stlookuptable",name="abc" | table name lookupname
| append [ | makeresults | eval lookupname="2ndlookuptable",name="abc" | table name lookupname ]
| append [ | makeresults | eval lookupname="3rdlookuptable",name="dxc" | table name lookupname ]
| append [ | makeresults| eval lookupname="4thlookuptable",name="xyz" | table name lookupname ]
| append [ | makeresults | eval lookupname="5thlookuptable",name="abc" | table name lookupname ] | stats list(lookupname) AS lookupname BY name
Thanks
Harish
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @akshayinnamuri,

please try something like this:

| inputlookup 1stlookuptable | eval lookupname="1stlookuptable" | fields name lookupname
| append [ | inputlookup 2ndlookuptable | eval lookupname="2ndlookuptable" | fields name lookupname ]
| append [ | inputlookup 3rdlookuptable | eval lookupname="3rdlookuptable" | fields name lookupname ]
| append [ | inputlookup 4thlookuptable | eval lookupname="4thlookuptable" | fields name lookupname ]
| append [ | inputlookup 5thlookuptable | eval lookupname="5thlookuptable" | fields name lookupname ]
| stats values(lookupname) AS lookupname BY name

Ciao.

Giuseppe

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Vibe-coding, AI, and Splunkcraft: Highlights from the .conf26 Builder Bar

If you stopped by the Builder Bar at .conf26, thank you! This year, we brought ...

Thanks for the Memories: .conf26 Took Learning to New Heights

Thank you, Splunk Community, for making .conf26 in Denver one for the books. From packed Splunk University ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...