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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...