<?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 Re: Error in 'eval' command: The expression is malformed. Expected in Security</title>
    <link>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485223#M15306</link>
    <description>&lt;P&gt;everything works before | eval part ,  I guess we cannot use eval with stats ?  &lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2019 19:41:46 GMT</pubDate>
    <dc:creator>simingmplatform</dc:creator>
    <dc:date>2019-09-23T19:41:46Z</dc:date>
    <item>
      <title>Error in 'eval' command: The expression is malformed. Expected</title>
      <link>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485222#M15305</link>
      <description>&lt;P&gt;Hi ALL, &lt;BR /&gt;
need help for a using case here.  &lt;/P&gt;

&lt;P&gt;we are trying to setup alert based on below data &lt;BR /&gt;
value1 ( the average of past 7days since yesterday) &lt;BR /&gt;
value2 ( the average of yesterday's day) &lt;/P&gt;

&lt;P&gt;if value2 is lower than 70% of value1 , trigger alerts. &lt;BR /&gt;
below is what I use to setup this query &lt;/P&gt;

&lt;P&gt;index=main topoName=EnrichmentTopology datacenter=NA desc=ENR131 earliest=-7d@d latest=-2d@d | stats avg(value) as 7day by desc | appendcols [ search index=main topoName=EnrichmentTopology datacenter=NA desc=ENR131 earliest=-2d@d latest=-1d@d | stats avg(value) as 1day by desc] | eval diff=(7day-1day) &lt;/P&gt;

&lt;P&gt;but it always return me &lt;BR /&gt;
Error in 'eval' command: The expression is malformed. Expected ).&lt;/P&gt;

&lt;P&gt;any idea ? thx a lot &lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 19:33:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485222#M15305</guid>
      <dc:creator>simingmplatform</dc:creator>
      <dc:date>2019-09-23T19:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. Expected</title>
      <link>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485223#M15306</link>
      <description>&lt;P&gt;everything works before | eval part ,  I guess we cannot use eval with stats ?  &lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 19:41:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485223#M15306</guid>
      <dc:creator>simingmplatform</dc:creator>
      <dc:date>2019-09-23T19:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. Expected</title>
      <link>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485224#M15307</link>
      <description>&lt;P&gt;Yes, &lt;CODE&gt;eval&lt;/CODE&gt; is allowed with &lt;CODE&gt;stats&lt;/CODE&gt;.  The problem appears to be with the field names which begin with digits.  Put them inside single quotes to force Splunk to treat them as field names.  &lt;CODE&gt;... | eval diff=('7day'-'1day')&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 19:59:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485224#M15307</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-09-23T19:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. Expected</title>
      <link>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485225#M15308</link>
      <description>&lt;P&gt;You may want to consider using multisearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| multisearch
[search index=main topoName=EnrichmentTopology datacenter=NA desc=ENR131 earliest=-7d@d latest=-2d@d | stats avg(value) as prevWeek]
[search index=main topoName=EnrichmentTopology datacenter=NA desc=ENR131 earliest=-2d@d latest=-1d@d | stats avg(value) as prevDay]
| eval alert=if(prevDay&amp;lt;(prevWeek*0.7),"Alert","No alert")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It doesn't look like you need a "by" clause in your stats, since there is only 1 value for desc.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 20:08:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485225#M15308</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-09-23T20:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. Expected</title>
      <link>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485226#M15309</link>
      <description>&lt;P&gt;correct, its after we use day7 and day1 , issue is gone, thx &lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 12:46:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Security/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/485226#M15309</guid>
      <dc:creator>simingmplatform</dc:creator>
      <dc:date>2019-09-24T12:46:57Z</dc:date>
    </item>
  </channel>
</rss>

