<?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 Foreach fails if field contains colon or dot. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Foreach-fails-if-field-contains-colon-or-dot/m-p/487408#M136219</link>
    <description>&lt;P&gt;On running this search,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | makeresults count=20
    | streamstats count
    | eval "genie.name"="foo", "genie:id"="bar"
    | foreach genie* 
        [eval new_&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;=&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;+"some string"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am expecting that two new fields named &lt;CODE&gt;new_name&lt;/CODE&gt; and &lt;CODE&gt;new_id&lt;/CODE&gt; would show, but that doesn't happen. Also an error comes up &lt;CODE&gt;Failed to parse templatized search for field 'genie:id'&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I am running on my local Splunk instance.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Sun, 26 Apr 2020 20:52:58 GMT</pubDate>
    <dc:creator>iet_ashish</dc:creator>
    <dc:date>2020-04-26T20:52:58Z</dc:date>
    <item>
      <title>Foreach fails if field contains colon or dot.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Foreach-fails-if-field-contains-colon-or-dot/m-p/487408#M136219</link>
      <description>&lt;P&gt;On running this search,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | makeresults count=20
    | streamstats count
    | eval "genie.name"="foo", "genie:id"="bar"
    | foreach genie* 
        [eval new_&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;=&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;+"some string"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am expecting that two new fields named &lt;CODE&gt;new_name&lt;/CODE&gt; and &lt;CODE&gt;new_id&lt;/CODE&gt; would show, but that doesn't happen. Also an error comes up &lt;CODE&gt;Failed to parse templatized search for field 'genie:id'&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I am running on my local Splunk instance.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Apr 2020 20:52:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Foreach-fails-if-field-contains-colon-or-dot/m-p/487408#M136219</guid>
      <dc:creator>iet_ashish</dc:creator>
      <dc:date>2020-04-26T20:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Foreach fails if field contains colon or dot.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Foreach-fails-if-field-contains-colon-or-dot/m-p/487409#M136220</link>
      <description>&lt;P&gt;It's not foreach that's failing, it's eval interpreting the dot as the concatenation operator. Enclose field names with operators in them in single quotes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| foreach genie* [ eval new_&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt; = '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;' + "some string" ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Apr 2020 20:58:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Foreach-fails-if-field-contains-colon-or-dot/m-p/487409#M136220</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2020-04-26T20:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Foreach fails if field contains colon or dot.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Foreach-fails-if-field-contains-colon-or-dot/m-p/487410#M136221</link>
      <description>&lt;P&gt;Thank you so much. This worked. &lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2020 06:26:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Foreach-fails-if-field-contains-colon-or-dot/m-p/487410#M136221</guid>
      <dc:creator>iet_ashish</dc:creator>
      <dc:date>2020-04-27T06:26:27Z</dc:date>
    </item>
  </channel>
</rss>

