All Apps and Add-ons

How to get the DBLOOKUPName from a lookup file (csv)?

rmuraly
Explorer

I have a lookup table with a list of customers and database names

customer.csv loaded into Splunk

customer|db_name
ABC_111|ABC_PROV1
XYZ_211|XYZ_PROV2

I have to do a dblookup using the db_name fetched from customer.csv

|dbquery $db_name$ "SELECT name, duration FROM  tab1"

$db_name$ needs to be fetched form customer.csv

0 Karma

rmuraly
Explorer

I got it working..

Created a saved search for the db_lookup as shown below.
|dbquery $schema_name$ "SELECT name, duration FROM tab1"

save this search as as db_lookup_test

Create a new Saved Search will pass in the parameter schema_name as shown below :
| savedsearch db_lookup_test [|inputlookup customer.csv |eval schema_name=db_info | return schema_name]

rmuraly
Explorer

|inputlookup customer.csv | eval schema_name=db_name |dbquery $schema_name$ "SELECT name, duration FROM tab1"

This is what I am trying to do. I need to get the schema_name dynamically from another lookup

0 Karma
Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

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

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...