<?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: Use | eval to sum float numbers in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Use-eval-to-sum-float-numbers/m-p/130481#M35562</link>
    <description>&lt;P&gt;see my update &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Apr 2014 13:44:01 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2014-04-14T13:44:01Z</dc:date>
    <item>
      <title>Use | eval to sum float numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-eval-to-sum-float-numbers/m-p/130478#M35559</link>
      <description>&lt;P&gt;Hi, i have 2 fields and they are float numbers, for example 2,7 and 0,6.&lt;BR /&gt;
I need to create a field that is the sum of these 2 fields, but if i use&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval toal=field_1+field_2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result is a concatenate string.&lt;/P&gt;

&lt;P&gt;I tried also convert num but 2 fields become 2 and 06 then the sum is 8.&lt;/P&gt;

&lt;P&gt;Could you help me?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 14 Apr 2014 13:19:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-eval-to-sum-float-numbers/m-p/130478#M35559</guid>
      <dc:creator>maurelio79</dc:creator>
      <dc:date>2014-04-14T13:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Use | eval to sum float numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-eval-to-sum-float-numbers/m-p/130479#M35560</link>
      <description>&lt;P&gt;Hi maurelio79,&lt;/P&gt;

&lt;P&gt;looks like the &lt;CODE&gt;,&lt;/CODE&gt; is the problem, because this will fail&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | head 1 | eval foo="2,6" | eval bar="3,5" | eval myResult=foo+bar | table myResult
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but this will work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | head 1 | eval foo="2.6" | eval bar="3.5" | eval myResult=foo+bar | table myResult
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;any way to replace the &lt;CODE&gt;,&lt;/CODE&gt; with a dot &lt;CODE&gt;.&lt;/CODE&gt; maybe by using some regex in SED mode?&lt;/P&gt;

&lt;P&gt;Based on the above run everywhere example you can do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | head 1 | eval foo="2,6" | eval bar="3,5" | rex field=foo mode=sed "s/,/./g" | rex field=bar mode=sed "s/,/./g" | eval myResult=foo+bar | table myResult
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If this fits your needs you can then set it up to be done automatically, just follow the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0.3/Data/Anonymizedatausingconfigurationfiles"&gt;docs example here.&lt;/A&gt;&lt;BR /&gt;
Or if possible, change the event source to have the numbers logged like this &lt;CODE&gt;2.5&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Mon, 14 Apr 2014 13:24:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-eval-to-sum-float-numbers/m-p/130479#M35560</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-04-14T13:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: Use | eval to sum float numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-eval-to-sum-float-numbers/m-p/130480#M35561</link>
      <description>&lt;P&gt;Good! Thanks! Values are genereted by a bash script, so i can replace "," with "." using sed. It will works. Thanks very much!&lt;/P&gt;</description>
      <pubDate>Mon, 14 Apr 2014 13:37:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-eval-to-sum-float-numbers/m-p/130480#M35561</guid>
      <dc:creator>maurelio79</dc:creator>
      <dc:date>2014-04-14T13:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Use | eval to sum float numbers</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-eval-to-sum-float-numbers/m-p/130481#M35562</link>
      <description>&lt;P&gt;see my update &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Apr 2014 13:44:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-eval-to-sum-float-numbers/m-p/130481#M35562</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-04-14T13:44:01Z</dc:date>
    </item>
  </channel>
</rss>

