Getting Data In

Saved Search working in UI, but errors when called via REST

emiller42
Motivator

I have a rather complex saved search that functions perfectly when accessed via the UI. But when a job is kicked off via REST, it fails, giving the following error: "Error in 'eval' command: Failed to parse the provided arguments. Usage: eval dest_key = expression"

Here is the search string itself:

(sourcetype="livecycle:webserver:server" OR sourcetype="alfresco_cms:app:ds") tag::host="dev" nodeUUID=* 
| regex nodeUUID="[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}" 
| eval status=case(DS_PDFG=="doc_status_change",state, DS_PDFG!="doc_status_change",DS_PDFG, searchmatch("error OR fail"),"Error")
| rex "(?msi)Conversion failed\s*:\s*(?<conversionFailed>.*?)nodeUUID" 
| rex "com.adobe.livecycle.assembler.client.ProcessingException message:(?<processingException>.*)nodeUUID" 
| rex "javax.resource.ResourceException\s*:\s*(?<resourceException>.*)" 
| rex "javax.naming.NameNotFoundException\s*:\s*(?<nameNotFound>.*)" 
| rex "\{\"exceptionType\":(?<exceptionType>.*)\}" 
| rex "\'Error\':\s*(?<error>.*)nodeUUID" 
| stats first(_time) as time, first(status) as status, first(conversionFailed) as conversionFailed, first(processingException) as processingException, first(resourceException) as resourceException, first(nameNotFound) as nameNotFound, first(exceptionType) as exceptionType, first(error) as error by nodeUUID 
| eval reason=coalesce(conversionFailed,resourceException,processingException, nameNotFound, exceptionType,error) 
| table time nodeUUID status reason 
| where status="Error" 
| sort -time 
| convert ctime(time)
0 Karma
1 Solution

emiller42
Motivator

Actually answered this myself, but posting it all here in case someone else runs into this:

As you can see from the code above, there are line breaks to aid readability. They did not cause any problems when running the search through the UI. If I scheduled the search, and used REST to access the results, there was no issue as well. However they did cause the search to fail if a new job using it was kicked off via REST.

Removing the line breaks resolved the issue, and the search jobs now run appropriately when invoked via REST.

View solution in original post

emiller42
Motivator

Actually answered this myself, but posting it all here in case someone else runs into this:

As you can see from the code above, there are line breaks to aid readability. They did not cause any problems when running the search through the UI. If I scheduled the search, and used REST to access the results, there was no issue as well. However they did cause the search to fail if a new job using it was kicked off via REST.

Removing the line breaks resolved the issue, and the search jobs now run appropriately when invoked via REST.

Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...