<?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 Why is division via EVAL is not working? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476438#M133775</link>
    <description>&lt;P&gt;My raw event is: &lt;BR /&gt;
&lt;CODE&gt;07 Nov 2019 01:24:49 | INFO  | DispatchThread: 6119 | *** Time taken to process 100 records 1009ms | GNS-C6CAE58A-3482-451B-A7B2-6F63DE58E4B3-002 | com.dhl.ms.sdm.jms.listeners.GNSMessageListener | onMessage |&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;i tried to get the number of records over time&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "Time taken to process(?[^\_]+)records(?[^ms]+)"
| eval aveDuration =recDuration/recNum
| table recNum recDuration aveDuration _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but, this is not returning the aveDuration even if i use the simple eval  =recDuration/recNum&lt;BR /&gt;
my rex is correct, and i even put in convert to num but, still not working.&lt;/P&gt;

&lt;P&gt;HELP.&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
    <pubDate>Wed, 06 Nov 2019 17:29:52 GMT</pubDate>
    <dc:creator>chiennylin</dc:creator>
    <dc:date>2019-11-06T17:29:52Z</dc:date>
    <item>
      <title>Why is division via EVAL is not working?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476438#M133775</link>
      <description>&lt;P&gt;My raw event is: &lt;BR /&gt;
&lt;CODE&gt;07 Nov 2019 01:24:49 | INFO  | DispatchThread: 6119 | *** Time taken to process 100 records 1009ms | GNS-C6CAE58A-3482-451B-A7B2-6F63DE58E4B3-002 | com.dhl.ms.sdm.jms.listeners.GNSMessageListener | onMessage |&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;i tried to get the number of records over time&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "Time taken to process(?[^\_]+)records(?[^ms]+)"
| eval aveDuration =recDuration/recNum
| table recNum recDuration aveDuration _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but, this is not returning the aveDuration even if i use the simple eval  =recDuration/recNum&lt;BR /&gt;
my rex is correct, and i even put in convert to num but, still not working.&lt;/P&gt;

&lt;P&gt;HELP.&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 17:29:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476438#M133775</guid>
      <dc:creator>chiennylin</dc:creator>
      <dc:date>2019-11-06T17:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why is division via EVAL is not working?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476439#M133776</link>
      <description>&lt;P&gt;I don't think the regex is correct, it looks like it might be capturing leading whitespace, try  &lt;CODE&gt;Time\s+taken\s+to\s+process\s+(?&amp;lt;recNum&amp;gt;\d+)\s+records\s+(?&amp;lt;recDuration&amp;gt;\d+)ms&lt;/CODE&gt; and see if it helps.&lt;/P&gt;

&lt;P&gt;Also, this might be overkill, but I like to be explicit in my SPL so I would do the following in the eval  &lt;CODE&gt;| eval aveDuration=('recDuration'/'recNum')&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2019 19:33:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476439#M133776</guid>
      <dc:creator>marycordova</dc:creator>
      <dc:date>2019-11-06T19:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Why is division via EVAL is not working?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476440#M133777</link>
      <description>&lt;P&gt;try this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "Time taken to process\s+(?&amp;lt;recNum&amp;gt;\d+)\s+records\s+(?&amp;lt;recDuration&amp;gt;\d+)" 
| eval aveDuration=recDuration/recNum 
| table recNum recDuration aveDuration _raw
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Nov 2019 19:34:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476440#M133777</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-06T19:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why is division via EVAL is not working?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476441#M133778</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "Time taken to process(?[&amp;lt;recNum&amp;gt;\d+)\s*records\s*(?&amp;lt;recDuration&amp;gt;\d+)"
| eval aveDuration = recDuration / recNum
| table recNum recDuration aveDuration _raw
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Nov 2019 22:12:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476441#M133778</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-06T22:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why is division via EVAL is not working?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476442#M133779</link>
      <description>&lt;P&gt;Thanks! this helps! &lt;BR /&gt;
this is now working. will take note on the whitespace for my rex moving forward. &lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 16:29:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-division-via-EVAL-is-not-working/m-p/476442#M133779</guid>
      <dc:creator>chiennylin</dc:creator>
      <dc:date>2019-11-07T16:29:47Z</dc:date>
    </item>
  </channel>
</rss>

