<?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 Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557857#M158429</link>
    <description>&lt;LI-CODE lang="markup"&gt; &amp;lt;query&amp;gt;"$ps_fn$" |rex field=message "(?&amp;amp;lt;Http&amp;amp;gt;HttpStatus): (?&amp;amp;lt;status&amp;amp;gt;\\d+)" | eval ActResult=case(status=400, "400", status=401, "401", status=402, "402", status=403, "403", status=404, "404") | stats count by ActResult | eval ActResult = count+" : "+ActResult&amp;lt;/query&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Is it better to do it like this?&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jun 2021 16:32:46 GMT</pubDate>
    <dc:creator>cmarrott</dc:creator>
    <dc:date>2021-06-30T16:32:46Z</dc:date>
    <item>
      <title>Error in 'eval' command: The expression is malformed. Expected ).</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557855#M158428</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;query&amp;gt;"$ps_fn$" |rex field=message "(?&amp;amp;lt;Http&amp;amp;gt;HttpStatus): (?&amp;amp;lt;status&amp;amp;gt;\\d+)" | eval status=(status, "4%"),"4xx" | stats count by status&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$time.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$time.latest$&amp;lt;/latest&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to make a pie chart that shows all the 4xx errors, and then breaks them out by error - so x% was 401, y% was 402, etc.&lt;BR /&gt;&lt;BR /&gt;But i am getting&amp;nbsp;&lt;STRONG&gt;Error in 'eval' command: The expression is malformed. Expected ).&lt;/STRONG&gt; when i run this on the dashboard.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 16:22:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557855#M158428</guid>
      <dc:creator>cmarrott</dc:creator>
      <dc:date>2021-06-30T16:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. Expected ).</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557857#M158429</link>
      <description>&lt;LI-CODE lang="markup"&gt; &amp;lt;query&amp;gt;"$ps_fn$" |rex field=message "(?&amp;amp;lt;Http&amp;amp;gt;HttpStatus): (?&amp;amp;lt;status&amp;amp;gt;\\d+)" | eval ActResult=case(status=400, "400", status=401, "401", status=402, "402", status=403, "403", status=404, "404") | stats count by ActResult | eval ActResult = count+" : "+ActResult&amp;lt;/query&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Is it better to do it like this?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 16:32:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557857#M158429</guid>
      <dc:creator>cmarrott</dc:creator>
      <dc:date>2021-06-30T16:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. Expected ).</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557858#M158430</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235963"&gt;@cmarrott&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;query&amp;gt;"$ps_fn$" |rex field=message "(?&amp;amp;lt;Http&amp;amp;gt;HttpStatus): (?&amp;amp;lt;status&amp;amp;gt;\\d+)" | where like(status,"4%") | stats count by status&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$time.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$time.latest$&amp;lt;/latest&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;▄︻̷̿┻̿═━一&lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 16:33:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557858#M158430</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-06-30T16:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. Expected ).</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557861#M158432</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cmarrott_0-1625070955852.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14886iB209BC859210CF38/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cmarrott_0-1625070955852.png" alt="cmarrott_0-1625070955852.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Confirmed this worked! Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 16:36:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557861#M158432</guid>
      <dc:creator>cmarrott</dc:creator>
      <dc:date>2021-06-30T16:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. Expected ).</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557862#M158433</link>
      <description>&lt;P&gt;What is this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eval status=(status, "4%"),"4xx"&lt;/LI-CODE&gt;&lt;P&gt;trying to do?&lt;/P&gt;&lt;P&gt;Also, I am not sure you need to escape the backslash in the rex as you are probably trying to escape the d and I expect you don't really need a field that always has the text "HttpStatus" in&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rex field=message "HttpStatus: (?&amp;amp;lt;status&amp;amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 16:40:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557862#M158433</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-06-30T16:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. Expected ).</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557864#M158434</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;What is this&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eval status=(status, "4%"),"4xx"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;trying to do?&lt;/P&gt;&lt;P&gt;Also, I am not sure you need to escape the backslash in the rex as you are probably trying to escape the d and I expect you don't really need a field that always has the text "HttpStatus" in&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;rex field=message "HttpStatus: (?&amp;amp;lt;status&amp;amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;I'm not sure I understand.&lt;BR /&gt;&lt;BR /&gt;To clarify what the query is intending to do overall is&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Search for a specific API, return all status codes of a specific type, display them in a piechart by % :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cmarrott_0-1625071432548.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/14887iAC3C808E6502E7A7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="cmarrott_0-1625071432548.png" alt="cmarrott_0-1625071432548.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is using the solution provided by&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 16:46:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-Expected/m-p/557864#M158434</guid>
      <dc:creator>cmarrott</dc:creator>
      <dc:date>2021-06-30T16:46:39Z</dc:date>
    </item>
  </channel>
</rss>

