<?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: Why is my search with an eval case condition resulting in error &amp;quot;The expression is malformed. Expected ).&amp;quot;? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245934#M73336</link>
    <description>&lt;P&gt;Could you please try to specify AND in the statement in CASE?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval response_cd=case(_raw="*applicationCode: 123*" AND _raw="*providerCode: AAA*" AND _raw!="*responseCode: 00*" AND _raw!="*responseCode: SM--*" ,"AAA", 1==1, "BBB")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Jul 2016 02:41:51 GMT</pubDate>
    <dc:creator>chanmi2</dc:creator>
    <dc:date>2016-07-07T02:41:51Z</dc:date>
    <item>
      <title>Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245929#M73331</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;When I execute the search below, it works fine:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="X" sourcetype="xx" "applicationCode: 123" "providerCode: AAA" NOT("responseCode: 00" OR "responseCode: SM--")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But when integrated with Case condition it fails with error: &lt;CODE&gt;Error in 'eval' command: The expression is malformed. Expected ).&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="X" sourcetype="xx" "applicationCode: 123"  responseCode=* | eval response_cd=case("applicationCode: 123" "providerCode: AAA" NOT("responseCode: 00" OR "responseCode: SM--" ,"AAA") | timechart count by response_cd usenull=f useother=f
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can some help me please!!!&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 01:50:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245929#M73331</guid>
      <dc:creator>saradachelluboy</dc:creator>
      <dc:date>2016-07-07T01:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245930#M73332</link>
      <description>&lt;P&gt;I see in my records something like &lt;CODE&gt;| eval cat=case(host == "aaaa", "customer", host == "bbbb", "customer")&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Can you please give this syntax a try?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 02:04:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245930#M73332</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-07-07T02:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245931#M73333</link>
      <description>&lt;P&gt;That is not delimited with colon so  splunk takes enter string as applicationCode: 123.&lt;/P&gt;

&lt;P&gt;I tried that earlier no luck.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 02:08:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245931#M73333</guid>
      <dc:creator>saradachelluboy</dc:creator>
      <dc:date>2016-07-07T02:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245932#M73334</link>
      <description>&lt;P&gt;Oh sorry, let me please check more ; -)&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 02:11:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245932#M73334</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2016-07-07T02:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245933#M73335</link>
      <description>&lt;P&gt;I'm confused as to what you're trying to accomplish.  What would you expect to end up in the repsonse_cd field after the eval?  &lt;/P&gt;

&lt;P&gt;To back up a moment, the case statement is used to test multiple conditions and return the value corresponding to the first matching condition.  So&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval field = case (condition1,value1, condition2, value2, ..., conditionN, valueN)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For example, if you had a field for operating system called os_ver that contained windows version numbers you might use this to get a corresponding name:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval os_name = case(os_ver="5.1","xp",os_ver="5.2","2003",os_ver="6.0","Vista",1=1,"unknown")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So what condition are you actually testing and what do you want the result to be?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 02:32:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245933#M73335</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2016-07-07T02:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245934#M73336</link>
      <description>&lt;P&gt;Could you please try to specify AND in the statement in CASE?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval response_cd=case(_raw="*applicationCode: 123*" AND _raw="*providerCode: AAA*" AND _raw!="*responseCode: 00*" AND _raw!="*responseCode: SM--*" ,"AAA", 1==1, "BBB")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2016 02:41:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245934#M73336</guid>
      <dc:creator>chanmi2</dc:creator>
      <dc:date>2016-07-07T02:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245935#M73337</link>
      <description>&lt;P&gt;I tried the below it didn't worked&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval response_cd=case(_raw="*applicationCode: 123*"  ,"AAA", 1==1, "BBB")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I removed from case and tried it is getting data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_raw="*applicationCode: 123*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;is it that _raw doesn't work for case?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 04:26:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245935#M73337</guid>
      <dc:creator>saradachelluboy</dc:creator>
      <dc:date>2016-07-07T04:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245936#M73338</link>
      <description>&lt;P&gt;I have multiple conditions and value to start with. For testing purpose I have added only one condition&lt;/P&gt;

&lt;P&gt;eval response_cd=case(_raw="&lt;EM&gt;applicationCode: 123&lt;/EM&gt;","AAA",_raw="&lt;EM&gt;applicationCode: XXX&lt;/EM&gt;", "BBB") | search response_cd=AAA&lt;/P&gt;

&lt;P&gt;Things are working fine if I put directly _raw="&lt;EM&gt;applicationCode: 123&lt;/EM&gt;" in search but when I am trying with if or case condition the data never pops up even if exists.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:08:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245936#M73338</guid>
      <dc:creator>saradachelluboy</dc:creator>
      <dc:date>2020-09-29T10:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245937#M73339</link>
      <description>&lt;P&gt;Try starting out with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval response_cd=case(_raw="*applicationCode: 123*", "AAA",
                            _raw="*applicationCode: XXX"*, "BBB"
                                                   true(), "UNK")
| stats count by response_cd
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2016 05:11:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245937#M73339</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-07-07T05:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245938#M73340</link>
      <description>&lt;P&gt;The Search doesn't work even if it contains the data applicationCode: 123 it never displays&lt;/P&gt;

&lt;P&gt;but if I removed case and tried search _raw="&lt;EM&gt;applicationCode: 123&lt;/EM&gt;" I get the data. It's weird.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 05:53:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245938#M73340</guid>
      <dc:creator>saradachelluboy</dc:creator>
      <dc:date>2016-07-07T05:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245939#M73341</link>
      <description>&lt;P&gt;_raw contains the whole string, need to have *(any character) in the beginning and the end&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 05:56:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245939#M73341</guid>
      <dc:creator>chanmi2</dc:creator>
      <dc:date>2016-07-07T05:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245940#M73342</link>
      <description>&lt;P&gt;Yes I tried with start at the beginning and end. It didn't worked&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_raw="*applicationCode: 123*"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2016 06:02:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245940#M73342</guid>
      <dc:creator>saradachelluboy</dc:creator>
      <dc:date>2016-07-07T06:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my search with an eval case condition resulting in error "The expression is malformed. Expected )."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245941#M73343</link>
      <description>&lt;P&gt;HUhu it worked with few changes&lt;/P&gt;

&lt;P&gt;case(&lt;STRONG&gt;match(_raw,"applicationCode: 123")&lt;/STRONG&gt;,"AAA",1=1,"UNK") &lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 06:09:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-search-with-an-eval-case-condition-resulting-in-error/m-p/245941#M73343</guid>
      <dc:creator>saradachelluboy</dc:creator>
      <dc:date>2016-07-07T06:09:25Z</dc:date>
    </item>
  </channel>
</rss>

