<?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: Splunk Simple Math Expression using Eval in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570450#M198824</link>
    <description>&lt;P&gt;Perhaps a bit convoluted by try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| gentimes start=-1 
| eval expr = "1*2+3*4+5*6"
| foreach expr
	[| eval return_{&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;} = &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]
| foreach return_*
    [| eval return=&amp;lt;&amp;lt;MATCHSEG1&amp;gt;&amp;gt;]&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 11 Oct 2021 11:25:10 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-10-11T11:25:10Z</dc:date>
    <item>
      <title>Splunk Simple Math Expression using Eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570433#M198819</link>
      <description>&lt;P&gt;I need a way to evaluate a simple math expression.&lt;/P&gt;&lt;P&gt;The following query works, and expr evaluates to result with a value of 44.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval result=
	[| makeresults count=1 
	| noop 
	| head 1 
	| eval expr = "1*2+3*4+5*6"
	| return $expr]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, I need to make the following type of query work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| gentimes start=-1 
| eval expr = "1*2+3*4+5*6"
| table expr, $expr&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do this ?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 09:01:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570433#M198819</guid>
      <dc:creator>plunkzombie</dc:creator>
      <dc:date>2021-10-11T09:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Simple Math Expression using Eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570443#M198820</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/239505"&gt;@plunkzombie&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;It seems you just need to get rid of the quotation marks.&lt;BR /&gt;&lt;BR /&gt;Try &lt;STRONG&gt;this:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| gentimes start=-1
| eval expr = 1*2+3*4+5*6&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;KR,&lt;BR /&gt;A.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 10:07:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570443#M198820</guid>
      <dc:creator>Alisher</dc:creator>
      <dc:date>2021-10-11T10:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Simple Math Expression using Eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570449#M198823</link>
      <description>&lt;P&gt;This was just an example to show the problem that I am facing.&lt;/P&gt;&lt;P&gt;In the real splunk query where I need to make this work, that 'expr' gets constructed as part of the query evaluation, and is different for different rows of the table.&amp;nbsp; There is no "quotation" marks, and it is a string type.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 11:06:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570449#M198823</guid>
      <dc:creator>plunkzombie</dc:creator>
      <dc:date>2021-10-11T11:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Simple Math Expression using Eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570450#M198824</link>
      <description>&lt;P&gt;Perhaps a bit convoluted by try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| gentimes start=-1 
| eval expr = "1*2+3*4+5*6"
| foreach expr
	[| eval return_{&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;} = &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;]
| foreach return_*
    [| eval return=&amp;lt;&amp;lt;MATCHSEG1&amp;gt;&amp;gt;]&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 11 Oct 2021 11:25:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570450#M198824</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-10-11T11:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Simple Math Expression using Eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570454#M198825</link>
      <description>&lt;P&gt;Thank you so much. This works!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 11:58:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-Simple-Math-Expression-using-Eval/m-p/570454#M198825</guid>
      <dc:creator>plunkzombie</dc:creator>
      <dc:date>2021-10-11T11:58:55Z</dc:date>
    </item>
  </channel>
</rss>

