<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Saved Search working in UI, but errors when called via REST in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Saved-Search-working-in-UI-but-errors-when-called-via-REST/m-p/61712#M12319</link>
    <description>&lt;P&gt;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"&lt;/P&gt;

&lt;P&gt;Here is the search string itself:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(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*(?&amp;lt;conversionFailed&amp;gt;.*?)nodeUUID" 
| rex "com.adobe.livecycle.assembler.client.ProcessingException message:(?&amp;lt;processingException&amp;gt;.*)nodeUUID" 
| rex "javax.resource.ResourceException\s*:\s*(?&amp;lt;resourceException&amp;gt;.*)" 
| rex "javax.naming.NameNotFoundException\s*:\s*(?&amp;lt;nameNotFound&amp;gt;.*)" 
| rex "\{\"exceptionType\":(?&amp;lt;exceptionType&amp;gt;.*)\}" 
| rex "\'Error\':\s*(?&amp;lt;error&amp;gt;.*)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)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 31 Jan 2012 22:22:44 GMT</pubDate>
    <dc:creator>emiller42</dc:creator>
    <dc:date>2012-01-31T22:22:44Z</dc:date>
    <item>
      <title>Saved Search working in UI, but errors when called via REST</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Saved-Search-working-in-UI-but-errors-when-called-via-REST/m-p/61712#M12319</link>
      <description>&lt;P&gt;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"&lt;/P&gt;

&lt;P&gt;Here is the search string itself:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(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*(?&amp;lt;conversionFailed&amp;gt;.*?)nodeUUID" 
| rex "com.adobe.livecycle.assembler.client.ProcessingException message:(?&amp;lt;processingException&amp;gt;.*)nodeUUID" 
| rex "javax.resource.ResourceException\s*:\s*(?&amp;lt;resourceException&amp;gt;.*)" 
| rex "javax.naming.NameNotFoundException\s*:\s*(?&amp;lt;nameNotFound&amp;gt;.*)" 
| rex "\{\"exceptionType\":(?&amp;lt;exceptionType&amp;gt;.*)\}" 
| rex "\'Error\':\s*(?&amp;lt;error&amp;gt;.*)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)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jan 2012 22:22:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Saved-Search-working-in-UI-but-errors-when-called-via-REST/m-p/61712#M12319</guid>
      <dc:creator>emiller42</dc:creator>
      <dc:date>2012-01-31T22:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Saved Search working in UI, but errors when called via REST</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Saved-Search-working-in-UI-but-errors-when-called-via-REST/m-p/61713#M12320</link>
      <description>&lt;P&gt;Actually answered this myself, but posting it all here in case someone else runs into this:&lt;/P&gt;

&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;Removing the line breaks resolved the issue, and the search jobs now run appropriately when invoked via REST.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2012 22:25:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Saved-Search-working-in-UI-but-errors-when-called-via-REST/m-p/61713#M12320</guid>
      <dc:creator>emiller42</dc:creator>
      <dc:date>2012-01-31T22:25:08Z</dc:date>
    </item>
  </channel>
</rss>

