<?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. An unexpected character is reached at '\&amp;quot; 5Q4RZH2 \&amp;quot;'. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338765#M100457</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;source="c:\\splunk monitors\\log(2).txt"  | eval ServiceTag = [search source="c:\\splunk monitors\\log(2).txt" | head 1 |  rex field=_raw "^[^\[\n]*\[(?P&amp;lt;SvcTag&amp;gt;[^\]]+)" | eval tag = SvcTag | return $tag ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 Dec 2017 09:56:01 GMT</pubDate>
    <dc:creator>sudeshna_dash</dc:creator>
    <dc:date>2017-12-13T09:56:01Z</dc:date>
    <item>
      <title>Error in 'eval' command: The expression is malformed. An unexpected character is reached at '\" 5Q4RZH2 \"'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338762#M100454</link>
      <description>&lt;P&gt;I am trying to extract a particular value from subsearch and use it to append in all the events of  a particular source file.&lt;/P&gt;

&lt;P&gt;My query is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="c:\\splunk monitors\\log(2).txt" | eval Servtag = \"[search source="c:\\splunk monitors\\log(2).txt" | head 1 | rex field=_raw "^[^\[\n]*\[(?P[^\]]+)" | eval tag = SvcTag | return $tag]\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here I am using &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"[search source="c:\\splunk monitors\\log(2).txt" | head 1 | rex field=_raw "^[^\[\n]*\[(?P[^\]]+)" | eval tag = SvcTag | return $tag]" subsearch to return a value "5Q4RZH2" and assign it to **Servtag** 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But it is throwing an error. I dont know how to return a string from subsearch and use it to assign a variable &lt;STRONG&gt;Servtag&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 08:38:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338762#M100454</guid>
      <dc:creator>sudeshna_dash</dc:creator>
      <dc:date>2017-12-13T08:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. An unexpected character is reached at '\" 5Q4RZH2 \"'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338763#M100455</link>
      <description>&lt;P&gt;@sudeshna_dash, please post the SPL by pressing the &lt;CODE&gt;code button&lt;/CODE&gt; (one with &lt;CODE&gt;101010&lt;/CODE&gt;) here on Splunk Answers so that special characters do not escape. You can also give four spaces before your SPL query and add one line gap with the previous text description.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 09:39:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338763#M100455</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-13T09:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. An unexpected character is reached at '\" 5Q4RZH2 \"'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338764#M100456</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;source="c:\\splunk monitors\\log(2).txt" | eval Servtag = case([search source="c:\\splunk monitors\\log(2).txt" | head 1 | rex field=_raw "^[^[\n]*[(?P[^]]+)" | eval tag = SvcTag | return 10000 tag],tag)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, check your rex expression. is it working fine? because I can not see field name given to extracted field in your rex expression.&lt;BR /&gt;
put your query in code sample format.&lt;BR /&gt;
let me know if it helps!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 09:39:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338764#M100456</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2017-12-13T09:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. An unexpected character is reached at '\" 5Q4RZH2 \"'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338765#M100457</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;source="c:\\splunk monitors\\log(2).txt"  | eval ServiceTag = [search source="c:\\splunk monitors\\log(2).txt" | head 1 |  rex field=_raw "^[^\[\n]*\[(?P&amp;lt;SvcTag&amp;gt;[^\]]+)" | eval tag = SvcTag | return $tag ]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Dec 2017 09:56:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338765#M100457</guid>
      <dc:creator>sudeshna_dash</dc:creator>
      <dc:date>2017-12-13T09:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. An unexpected character is reached at '\" 5Q4RZH2 \"'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338766#M100458</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="c:\\splunk monitors\\log(2).txt"  | eval ServiceTag = case([search source="c:\\splunk monitors\\log(2).txt" | head 1 |  rex field=_raw "^[^\[\n]*\[(?P&amp;lt;SvcTag&amp;gt;[^\]]+)" | eval tag = SvcTag | return 10000 tag ],tag)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if it helps!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 10:00:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338766#M100458</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2017-12-13T10:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error in 'eval' command: The expression is malformed. An unexpected character is reached at '\" 5Q4RZH2 \"'.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338767#M100459</link>
      <description>&lt;P&gt;Thanks @mayrr98 but this is not working. I want to get the data from the "tag variable" and store it&lt;BR /&gt;
 &lt;CODE&gt;search source="c:\\splunk monitors\\log(2).txt" | head 1 |  rex field=_raw "^[^\[\n]*\[(?P&amp;lt;SvcTag&amp;gt;[^\]]+)" | eval tag = SvcTag | return $tag&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2017 10:36:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Error-in-eval-command-The-expression-is-malformed-An-unexpected/m-p/338767#M100459</guid>
      <dc:creator>sudeshna_dash</dc:creator>
      <dc:date>2017-12-13T10:36:21Z</dc:date>
    </item>
  </channel>
</rss>

