<?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: Assign result of a subsearch to a token in an &amp;lt;eval&amp;gt; dashboard XML tag in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Assign-result-of-a-subsearch-to-a-token-in-an-lt-eval-gt/m-p/519583#M146345</link>
    <description>&lt;P&gt;Why are you using a subsearch by itself?&amp;nbsp; Use a search.&amp;nbsp; Not that it really matters since you can't use a search (or subsearch) query in an &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt;.&amp;nbsp; The &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; element requires an eval expression such as &lt;FONT face="courier new,courier"&gt;"\"blah\"'&lt;/FONT&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Sep 2020 00:52:23 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-09-15T00:52:23Z</dc:date>
    <item>
      <title>Assign result of a subsearch to a token in an &lt;eval&gt; dashboard XML tag</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Assign-result-of-a-subsearch-to-a-token-in-an-lt-eval-gt/m-p/519581#M146343</link>
      <description>&lt;P&gt;It's possible to assign the result of a subsearch to a field with the &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eval" target="_self"&gt;eval command&lt;/A&gt;&amp;nbsp;as can be seen in the following snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;| makeresults
| eval blahblah = [
  | makeresults 
  | eval search="\"blah\""
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I accomplish this in an &amp;lt;eval&amp;gt; dashboard XML tag?&lt;/P&gt;&lt;P&gt;I've tried the below in the dashboard XML source but the result is just '$blahblah$' instead of 'blah', as if the `blahblah` token is not defined:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;eval token="blahblah"&amp;gt;
  [
    | makeresults
    | eval search="\"blah\""
  ]
&amp;lt;/eval&amp;gt;

&amp;lt;!-- OR --&amp;gt;

&amp;lt;eval token="blahblah"&amp;gt;
  [
    | makeresults 
    | eval myOutput = "\"blah\""
    | return $myOutput
  ]
&amp;lt;/eval&amp;gt;

&amp;lt;!-- ... --&amp;gt;

&amp;lt;panel&amp;gt;
  &amp;lt;title&amp;gt;DEBUG&amp;lt;/title&amp;gt;
  &amp;lt;html&amp;gt;
    &amp;lt;pre&amp;gt;
      blahblah = '$blahblah$'
    &amp;lt;/pre&amp;gt;
  &amp;lt;/html&amp;gt;
&amp;lt;/panel&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;In the &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.6/Viz/tokens#Dashboard_&amp;amp;lt;eval&amp;amp;gt;_expression_functionality" target="_self"&gt;documentation about &amp;lt;eval&amp;gt; and its limitations&lt;/A&gt;, subsearches are not listed in the list of limitations and unsupported functionality, so this should be possible.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 23:47:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Assign-result-of-a-subsearch-to-a-token-in-an-lt-eval-gt/m-p/519581#M146343</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2020-09-14T23:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Assign result of a subsearch to a token in an &lt;eval&gt; dashboard XML tag</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Assign-result-of-a-subsearch-to-a-token-in-an-lt-eval-gt/m-p/519583#M146345</link>
      <description>&lt;P&gt;Why are you using a subsearch by itself?&amp;nbsp; Use a search.&amp;nbsp; Not that it really matters since you can't use a search (or subsearch) query in an &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt;.&amp;nbsp; The &lt;FONT face="courier new,courier"&gt;eval&lt;/FONT&gt; element requires an eval expression such as &lt;FONT face="courier new,courier"&gt;"\"blah\"'&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 00:52:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Assign-result-of-a-subsearch-to-a-token-in-an-lt-eval-gt/m-p/519583#M146345</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-09-15T00:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: Assign result of a subsearch to a token in an &lt;eval&gt; dashboard XML tag</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Assign-result-of-a-subsearch-to-a-token-in-an-lt-eval-gt/m-p/519591#M146348</link>
      <description>&lt;P&gt;According to the documentation which I linked in my original post, the &amp;lt;eval&amp;gt; tag's contents behave the same as the eval SPL command with a small list of differences. This list of differences does not include the inability to use subsearches.&lt;/P&gt;&lt;P&gt;If you click the link I included, it brings you right to the section which mentions this but I've nevertheless pasted it below for your convenience.&lt;/P&gt;&lt;P&gt;If the documentation is not true, it should be updated.&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;The dashboard&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;eval&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expression has the same syntax and semantics as the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;eval&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expression syntax for SPL queries. Most of the same&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;eval&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expression functionality is the same between the dashboard&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;eval&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expression and the SPL version of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;eval. However, there are some important exceptions.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Unavailable dashboard&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;eval&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expression functions&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;DIV class="li_content"&gt;commands(X)&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;DIV class="li_content"&gt;searchmatch(X)&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;DIV class="li_content"&gt;exact(X)&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;DIV class="li_content"&gt;Cryptographic hash functions:&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;*md5(X) *sha1(X) *sha256(X) *sha512(X) *sigfig(X) *spath(X,"Y")&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;eval&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expression functions with different behavior for dashboards&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;DIV class="li_content"&gt;relative_time(X,Y): Uses client time zone.&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;DIV class="li_content"&gt;strftime(X,Y): Uses client time zone.&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;DIV class="li_content"&gt;strptime(X,Y): Uses client time zone.&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;It is also important to note that regular expressions in dashboard&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;eval&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expressions use the syntax and semantics of the JavaScript regular expression engine. This is not the same engine used for SPL&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;eval&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expressions. If you are using regular expressions in search tokens, check that syntax and semantics match those for JavaScript.&lt;/P&gt;&lt;P&gt;To learn more about&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;eval&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;expression functions, see&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/8.0.5/SearchReference/Eval" target="_blank" rel="noopener"&gt;eval&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;I&gt;Search Reference&lt;/I&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2020 03:14:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Assign-result-of-a-subsearch-to-a-token-in-an-lt-eval-gt/m-p/519591#M146348</guid>
      <dc:creator>DanK</dc:creator>
      <dc:date>2020-09-15T03:14:45Z</dc:date>
    </item>
  </channel>
</rss>

