Splunk Search

Modify a wildcard based lookup to include real values to use in Lookup command? Can you improve this?

MonkeyK
Builder

I am trying to use a wildcard based lookup table as part of a query that will get all non-wildcard based values so that I can use them in a real lookup.

My company maintains 100+ firewalls, sometimes more. All the firewalls send traffic logs to Splunk. I would like to be able to break down the traffic logs into locations without having to know every single firewall name, so I created a lookup table that looks something like this

firewalls.csv

description, location,  search_name,       monitored
testFW1,     location1, fw-loc1-*,         Y
testFW2,     location2, fw-loc2-*,         Y
testFWsub2,  location2, fw-branch*-loc3-*, Y

If it were not for the fact that I need a wildcard in the middle of the string to find my lookup data, I could just ask my admin to change some .conf file so that my csv could do wildcard lookups.

I solved this by searching for values and then aggregating on the wildcard value, like this

|inputlookup firewalls.csv 
| map maxsearches=20 search="|tstats prestats=t values(host) where index=pan_logs host=$dvc$ | stats values(host) as host | eval dvc=$dvc$" 
| append [|inputlookup firewalls.csv]  | append [|inputlookup firwalls_lookup.csv] 
| stats values(host) as host first(loc) as loc first(monitored) as monitored first(note) as note by dvc
|outputlookup firewalls_lookup.csv

Now I can use the hosts values in a lookup

index=pan_logs | head 10 | lookup firewalls_lookup.csv host | table src_ip dest_ip host location monitored

This seems like a lot of work though. Basically, I am using a csv to create a legit lookup table (would probably run this nightly).
Is there a better approach?

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...