All Apps and Add-ons

Error on passing value to dbxquery procedure parameter using map command

mouradbouzaffar
Loves-to-Learn Lots

Hi,

I need to run a search ,take the output, and pass it to a dbxquery search via map search.

So when i do this as below without the search and th map, every thing work :

| dbxquery query="EXEC [CTS2_Repository].[dbo].[C_sp_CallTransac] 'DE1', '2021-03-02 00:00:00', '2021-03-02 23:59:59'" connection=10VM_CI_BI_UAT

But when i transform that as below, i get the error "Search Factory: Unknown search command 'cts2'."

| eval cust_id="DE1"
| map search=\" | dbxquery procedure=\\\"{{call [CTS2_Repository].[dbo].[C_sp_CallTransac](?,?,?)}}\\\" connection=\"10VM_CI_BI_UAT\" params=\\\"\\\"$cust_id$\\\", 2021-03-03 00:00:00, 2021-03-03 23:59:59\\\"\"

Any help is appreciated.

 

 

Labels (2)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Don't escape the quotation marks that enclose map's search argument.  They're part of the syntax.  You don't need triple escapes for embedded quotes - that's just for the rex command.

---
If this reply helps you, Karma would be appreciated.
0 Karma

mouradbouzaffar
Loves-to-Learn Lots

Hi,

I tried like this

| eval cust_id="DE1"
| map search="|dbxquery procedure=\"{call [CTS2_Repository].[dbo].[C_sp_CallTransac](?,?,?)}\" connection=\"10VM_CI_BI_UAT\" params=\"\"$cust_id$\", 2021-03-03 00:00:00, 2021-03-03 23:59:59\""

But i get this message :

Error in 'map': Did not find value for required attribute 'cust_id'.

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

If this query is part of a dashboard then you must use $$cust_id$$ within the map command.

If it's not in a dashboard then I don't know what the problem is.

---
If this reply helps you, Karma would be appreciated.
0 Karma

mouradbouzaffar
Loves-to-Learn Lots

The query is not a part of dashboard.

It's a schedule search.

Thanks for your help

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 ...