<?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 eval fails if fields have a &amp;quot;:&amp;quot; in their name in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71006#M17767</link>
    <description>&lt;P&gt;I have some data in the form of xml records. The fields extract fine using the xmlkv operator, but I can not perform coaelese  or similar eval functions because of the ":" in the name of the key fields I am interested in:&lt;/P&gt;

&lt;P&gt;source data example:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;c:ResponseHeader&amp;gt;
&amp;lt;c:StatusOk&amp;gt;true&amp;lt;/c:StatusOk&amp;gt;
&amp;lt;c:StatusMessage/&amp;gt;
&amp;lt;/c:ResponseHeader&amp;gt;
&amp;lt;c:AdminContractId&amp;gt;123456&amp;lt;/c:AdminContractId&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;search command I would like to use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| xmlkv |eval ctxid=coalesce(c:AdminContractId, contract:AdminContractId) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;fails with error &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;Error in 'eval' command: The expression is malformed. Expected ).&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;even a simpler standalone example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval myExample=an:example
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;fails with&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;Error in 'eval' command: The operator at ':example' is invalid.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Fri, 15 Oct 2010 07:26:49 GMT</pubDate>
    <dc:creator>bnolen</dc:creator>
    <dc:date>2010-10-15T07:26:49Z</dc:date>
    <item>
      <title>eval fails if fields have a ":" in their name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71006#M17767</link>
      <description>&lt;P&gt;I have some data in the form of xml records. The fields extract fine using the xmlkv operator, but I can not perform coaelese  or similar eval functions because of the ":" in the name of the key fields I am interested in:&lt;/P&gt;

&lt;P&gt;source data example:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;c:ResponseHeader&amp;gt;
&amp;lt;c:StatusOk&amp;gt;true&amp;lt;/c:StatusOk&amp;gt;
&amp;lt;c:StatusMessage/&amp;gt;
&amp;lt;/c:ResponseHeader&amp;gt;
&amp;lt;c:AdminContractId&amp;gt;123456&amp;lt;/c:AdminContractId&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;search command I would like to use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| xmlkv |eval ctxid=coalesce(c:AdminContractId, contract:AdminContractId) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;fails with error &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;Error in 'eval' command: The expression is malformed. Expected ).&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;even a simpler standalone example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval myExample=an:example
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;fails with&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;Error in 'eval' command: The operator at ':example' is invalid.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 15 Oct 2010 07:26:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71006#M17767</guid>
      <dc:creator>bnolen</dc:creator>
      <dc:date>2010-10-15T07:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: eval fails if fields have a ":" in their name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71007#M17768</link>
      <description>&lt;P&gt;are you sure you get the same error for | eval example=an:example?&lt;BR /&gt;
i believe it should actually be "Error in 'eval' command: The operator at ':example' is invalid.&lt;/P&gt;

&lt;P&gt;It seems to me that this is just not accepted. Fix your fileds is what i would say.&lt;/P&gt;

&lt;P&gt;Here is an example i made up:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | head 2000 | eval x:y=linecount | eval z=x:y
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the first eval works just fine, and a new field called x:y gets created, however the second eval, breaks. Again, i believe its normal behavior, but we could possibly ask our Dev's and find out for sure..&lt;/P&gt;

&lt;P&gt;as a workaround try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;* | head 2000 | eval x:y=linecount | eval z="x:y"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;note the ""&lt;BR /&gt;
Cheerio,&lt;BR /&gt;
.gz&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2010 08:05:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71007#M17768</guid>
      <dc:creator>Genti</dc:creator>
      <dc:date>2010-10-15T08:05:45Z</dc:date>
    </item>
    <item>
      <title>Re: eval fails if fields have a ":" in their name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71008#M17769</link>
      <description>&lt;P&gt;op updated to reflect actual error from the "cooked" example&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2010 08:12:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71008#M17769</guid>
      <dc:creator>bnolen</dc:creator>
      <dc:date>2010-10-15T08:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: eval fails if fields have a ":" in their name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71009#M17770</link>
      <description>&lt;P&gt;I have found  a hack type workaround - perform a sed before the xmlkv:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw mode=sed "s/\:/_/g"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Oct 2010 08:50:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71009#M17770</guid>
      <dc:creator>bnolen</dc:creator>
      <dc:date>2010-10-15T08:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: eval fails if fields have a ":" in their name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71010#M17771</link>
      <description>&lt;P&gt;Your solution of encasing the RHS of the equals sign in quotation marks means that it is treated as a string, thus Z will always equal the literal string "x:y" and not the value of variable x:y&lt;/P&gt;

&lt;P&gt;Nice idea though, but tried that already, as well as trying to "escape" and colon with a backslash... also no joy.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Oct 2010 19:11:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71010#M17771</guid>
      <dc:creator>bnolen</dc:creator>
      <dc:date>2010-10-16T19:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: eval fails if fields have a ":" in their name</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71011#M17772</link>
      <description>&lt;P&gt;You should wrap the fieldname name with '$'&lt;/P&gt;

&lt;P&gt;For example:&lt;BR /&gt;
| eval myExample=$an:example$&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2012 10:54:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-fails-if-fields-have-a-quot-quot-in-their-name/m-p/71011#M17772</guid>
      <dc:creator>bfernandez</dc:creator>
      <dc:date>2012-11-27T10:54:11Z</dc:date>
    </item>
  </channel>
</rss>

