Splunk Search

Limit search results to those in a LOOKUP table

atornes
Path Finder

I have a lookup table with a bunch of results. There is a a field called "accounts" representing a list of customers. Our splunk index has data on many more accounts than the lookup table has. How can I limit the results of my query to only the ones in the Lookup table?

In pseudo code terms, I want to pull all accounts from the lookup table into the array, then limit my search with a WHERE command to the accounts in the array.

Tags (1)
0 Karma
1 Solution

kristian_kolb
Ultra Champion

Search like so;

your_search_for_all_events_with_accounts [| inputlookup your_lookup_file | fields + accounts]

the subsearch (in square brackets) will run first and return a list of acctouns in the format

(accounts=aaaa) OR (accounts=bbbb) OR (accounts=cccc) OR (accounts=dddd)

which are added to the outer search, which is then run.

/k

View solution in original post

kristian_kolb
Ultra Champion

Search like so;

your_search_for_all_events_with_accounts [| inputlookup your_lookup_file | fields + accounts]

the subsearch (in square brackets) will run first and return a list of acctouns in the format

(accounts=aaaa) OR (accounts=bbbb) OR (accounts=cccc) OR (accounts=dddd)

which are added to the outer search, which is then run.

/k

Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...