Splunk Search

Why using semicolon as multivalue delimiter results in "Unbalanced quotes" error when using the API?

rjdefrancisco
Explorer

The following works fine in the Search app:

 

... | makemv delim=";" hashes | ...

 

The equivalent curl call

 

curl ... -d search="search ... | makemv delim=\";\" hashes | ..." -d output_mode=csv

 

fails with an "Unbalanced quotes" error. 

Delimiters other than ; work fine. I tried to escape the semicolon, use Unicode values, replace the string with a variable, all to no avail. Any suggestions?

Labels (2)
0 Karma
1 Solution

rjdefrancisco
Explorer

I finally solved the problem by replacing the semicolon  with its URL encoding (%3b) inside the curl command:

curl ... -d search="search ... | makemv delim=\"%3b\" hashes | ..." -d output_mode=csv

 

View solution in original post

rjdefrancisco
Explorer

I finally solved the problem by replacing the semicolon  with its URL encoding (%3b) inside the curl command:

curl ... -d search="search ... | makemv delim=\"%3b\" hashes | ..." -d output_mode=csv

 

richgalloway
SplunkTrust
SplunkTrust

How are you escaping the semicolon in the curl command?  I suspect you need to use a shell escape to keep the shell from thinking the ; separates two commands (and makes Splunk think the search is missing a quote).

curl ... -d search="search ... | makemv delim=\"~;\" hashes | ..." -d output_mode=csv
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...