<?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 What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375676#M110376</link>
    <description>&lt;P&gt;This is the eval statement i am using along with case but getting error.&lt;/P&gt;

&lt;P&gt;eval total=case(critical&amp;gt;0 AND high&amp;gt;0,critical+high,critical&amp;gt;0,critical,high&amp;gt;0,high,1==1,0)&lt;/P&gt;</description>
    <pubDate>Sat, 05 May 2018 11:54:03 GMT</pubDate>
    <dc:creator>sarwshai</dc:creator>
    <dc:date>2018-05-05T11:54:03Z</dc:date>
    <item>
      <title>What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375676#M110376</link>
      <description>&lt;P&gt;This is the eval statement i am using along with case but getting error.&lt;/P&gt;

&lt;P&gt;eval total=case(critical&amp;gt;0 AND high&amp;gt;0,critical+high,critical&amp;gt;0,critical,high&amp;gt;0,high,1==1,0)&lt;/P&gt;</description>
      <pubDate>Sat, 05 May 2018 11:54:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375676#M110376</guid>
      <dc:creator>sarwshai</dc:creator>
      <dc:date>2018-05-05T11:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375677#M110377</link>
      <description>&lt;P&gt;It does not give an error for me.&lt;/P&gt;</description>
      <pubDate>Sat, 05 May 2018 14:10:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375677#M110377</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-05T14:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375678#M110378</link>
      <description>&lt;P&gt;Do you have any other &lt;CODE&gt;(&lt;/CODE&gt; or &lt;CODE&gt;)&lt;/CODE&gt;in the rest of your query? &lt;/P&gt;</description>
      <pubDate>Sat, 05 May 2018 14:19:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375678#M110378</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-05T14:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375679#M110379</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/110013"&gt;@xpac&lt;/a&gt;, No i checked for all brackets, all is perfect.&lt;BR /&gt;
Here is the full query,&lt;/P&gt;

&lt;P&gt;index=nessus sourcetype=nessus:scan  (severity = "critical" OR severity = "high" OR severity = "medium" OR severity = "low" OR severity = "informational") &lt;BR /&gt;
| stats dc(signature) as vuln_count count by severity,dest &lt;BR /&gt;
| chart useother=&lt;CODE&gt;useother&lt;/CODE&gt; first(vuln_count) over dest by severity &lt;BR /&gt;
|  eval total=case(critical&amp;gt;0 AND high&amp;gt;0,critical+high,critical&amp;gt;0,critical,high&amp;gt;0,high,1==1,0) &lt;BR /&gt;
| eval subTotal=case(medium&amp;gt;0 AND low&amp;gt;0,medium+low,medium&amp;gt;0,medium,low&amp;gt;0,low,1==1,0) &lt;BR /&gt;
| eval subSubTotal=case(informational&amp;gt;0 AND unknown&amp;gt;0,informational+unknown,informational&amp;gt;0,informational,unknown&amp;gt;0,unknown,1==1,0) &lt;/P&gt;

&lt;P&gt;I am getting error for all the eval statements here &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1406"&gt;@woodcock&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:25:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375679#M110379</guid>
      <dc:creator>sarwshai</dc:creator>
      <dc:date>2020-09-29T19:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375680#M110380</link>
      <description>&lt;P&gt;I just put that search into my Splunk, and it is perfectly valid.&lt;BR /&gt;
The only thing that I had to remove is the &lt;CODE&gt;useother=´useother´&lt;/CODE&gt; part - because I don't have that macro.&lt;BR /&gt;
Just in case, can you post the content of that macro?&lt;/P&gt;</description>
      <pubDate>Sat, 05 May 2018 17:34:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375680#M110380</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-05-05T17:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375681#M110381</link>
      <description>&lt;P&gt;'useother'=true&lt;BR /&gt;
That's it.&lt;/P&gt;</description>
      <pubDate>Sat, 05 May 2018 17:37:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375681#M110381</guid>
      <dc:creator>sarwshai</dc:creator>
      <dc:date>2018-05-05T17:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375682#M110382</link>
      <description>&lt;P&gt;I still do not get any errors.&lt;/P&gt;</description>
      <pubDate>Sat, 05 May 2018 17:39:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375682#M110382</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-05T17:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375683#M110383</link>
      <description>&lt;P&gt;Do you have logs from nessus? If so , can you kindly share the results?, don't know why i am getting that error?&lt;/P&gt;</description>
      <pubDate>Sat, 05 May 2018 17:46:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375683#M110383</guid>
      <dc:creator>sarwshai</dc:creator>
      <dc:date>2018-05-05T17:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375684#M110384</link>
      <description>&lt;P&gt;You must ensure that all fields based on &lt;CODE&gt;severity&lt;/CODE&gt; ( &lt;CODE&gt;critical&lt;/CODE&gt;, &lt;CODE&gt;high&lt;/CODE&gt;, etc. ) are all numbers or you will get an error, so try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nessus sourcetype=nessus:scan (severity = "critical" OR severity = "high" OR severity = "medium" OR severity = "low" OR severity = "informational") 
| stats dc(signature) as vuln_count count by severity,dest 
| chart useother=`useother` first(vuln_count) over dest by severity
| foreach critical high medium low informational
   [ rex field=&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; mode=sed "s/[\r\n\s]//g" | eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;=tonumber(&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;) ]
| eval total=case(
   critical&amp;gt;0 AND high&amp;gt;0,         critical+high,
   critical&amp;gt;0,                    critical,
   high&amp;gt;0,                        high,
   true(),                        0) 
| eval subTotal=case(
   medium&amp;gt;0 AND low&amp;gt;0,            medium+low,
   medium&amp;gt;0,                      medium,
   low&amp;gt;0,                         low,
   true(),                        0) 
| eval subSubTotal=case(
   informational&amp;gt;0 AND unknown&amp;gt;0, informational+unknown,
   informational&amp;gt;0,               informational,
   unknown&amp;gt;0,                     unknown,
   true(),                        0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 May 2018 19:10:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375684#M110384</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-05T19:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375685#M110385</link>
      <description>&lt;P&gt;Ughh, My bad! i copied the search from the earlier dashboard's source XML and pasted into search box, this '&amp;gt;'  sign was and is present as ';' in the dashboard xml , that is why it was giving error. Otherwise the eval statement is correct. &lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 11:56:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375685#M110385</guid>
      <dc:creator>sarwshai</dc:creator>
      <dc:date>2018-05-10T11:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: What's wrong with this eval statement? Getting 'Error in 'eval' command: The expression is malformed. Expected ). ' Error.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375686#M110386</link>
      <description>&lt;P&gt;Click &lt;CODE&gt;Accept&lt;/CODE&gt; on your answer here to close the question.&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 14:45:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/What-s-wrong-with-this-eval-statement-Getting-Error-in-eval/m-p/375686#M110386</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-05-10T14:45:44Z</dc:date>
    </item>
  </channel>
</rss>

