Splunk Search

Error in 'lookup' command within Saved Searches

nicktate
Explorer

I've seen a few posts that talk about handling lookups from the back end or through uploading CSV's that don't really apply to my situation.

I've created a DBquery pull that draws in information into the lookup from a SQL database. I've written a few queries that connects to the lookup and have worked perfectly fine.

I'm attempting to run a lookup command within a saved search that has parameters that I'm passing through. I can execute the saved search manually, without passing parameter, perfectly fine. However, when I tried to execute the saved search and pass the parameters along I receive the "Error in 'lookup' command: Could not find all of the specified destination fields in the lookup table" statement.

Any thoughts or suggestions would be helpful, thank you!

| savedsearch "search_iris_ca_server_count" t_parent_businessname="Bus1" t_businessunit_businessname="Bus2"

Tags (2)

gkanapathy
Splunk Employee
Splunk Employee

It seems likely that the lookup definition is not exported (i.e., visible) in the app in which you're trying to run the saved search. The saved search on the other hand is visible. Perhaps when you run the saved search directly, you're in a different app. You can fix this by switching apps, or by setting the lookup to be global rather than app-specific.

0 Karma

nicktate
Explorer

Just double checked on the lookup definition and it is set as global for all apps so I don't think that is the problem. I tried removing the parameters from the saved search and running it again, just to try and get a saved search to execute but it still is giving me the error.

Has anyone successfully executed a lookup within a saved search?

0 Karma

nicktate
Explorer

index=summary source="Server_Inventory_v1.2"

Parent_Business="$t_parent_businessName$"
Business_Unit="$t_businessUnit_businessName$"
| lookup lookup_mappings.csv.gz serverID as serverID OUTPUT AppID
| stats
count(serverID) as Servers
count(eval(Is_Critical_Server="true")) as Critical_Servers
dc(AppID) as AppsOnServer by Parent_Business, Business_Unit
| table Business_Unit Servers Critical_Servers AppsOnServer

0 Karma

somesoni2
Revered Legend

Would you mind pasting the saved search in which you are using lookup?

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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