Splunk Search

Are Lookups appropriate here?

marquiselee
Path Finder

I work with a bunch of media companies and on monthly basis licensing for the content they provide changes. So this week I may have rights to display the BRANDS 'NBC' 'HBO' and 'CNN' video content on mobile devices but next week that list may look like 'CBS' NBC' 'AMC' and 'ABC'.

Right now I have many searches that look like this but with nearly 100 brands...

search AND (BRAND="HBO" OR BRAND="CBS" OR BRAND="SHOWTIME") | Table ...

Obviously I'd rather not change each search every time licensing agreements change. I've created a csv listing each of the Brands I have licensing for and added it as a lookup table. that looks like this.

TYPE, VALUE
Brand,HBO
Brand,CBS
Brand,SHOWTIME
Brand,NBC
etc...

Is this a proper use for lookups and how do I implement this in my searches?

Tags (3)
0 Karma
1 Solution

alacercogitatus
SplunkTrust
SplunkTrust

If you place that csv file in the $APP_HOME/lookups (as Brands.csv), you can then combine that with this:

search [ |inputlookup Brands.csv|rename VALUE as Brand|table Brand|format "(" "" "" "" "OR" ")" ]| Table...

View solution in original post

alacercogitatus
SplunkTrust
SplunkTrust

If you place that csv file in the $APP_HOME/lookups (as Brands.csv), you can then combine that with this:

search [ |inputlookup Brands.csv|rename VALUE as Brand|table Brand|format "(" "" "" "" "OR" ")" ]| Table...

marquiselee
Path Finder

thanks much! I got it working eventually... I had to reformat my csv and remove the 'table Brand' from the subsearch. woot!

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

This should return the contents of your CSV: |inputlookup Brands.csv|rename VALUE as Brand|table Brand|format "(" "" "" "" "OR" ")".

marquiselee
Path Finder

hmmm... i must be doing something wrong. I'm not sure it's accessing Brands.csv should a simple search of inputlookup Brands.csv return something?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...