<?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: How to multiply all numbers in a multivalue field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132938#M36300</link>
    <description>&lt;P&gt;Then I don't understand the meaning of your survivalRate &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Basic example: Half dies on the first day, the other half dies on the second day. First-day-survivalRate is 0.5, obviously. Using your multiplication, the second-day-survivalRate is 0.25... which is where I'm confused. 100% is dead, 50% died during the second day, how is the survival rate 0.25?&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jul 2015 20:14:50 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2015-07-23T20:14:50Z</dc:date>
    <item>
      <title>How to multiply all numbers in a multivalue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132933#M36295</link>
      <description>&lt;P&gt;I am trying to find the rate at which parts fail. Parts send me a message every x amount of time. If I do not get a message from a part after around 20 days, I consider it dead. I have calculated the rate of "death" for each day. The last step is to multiply this value with the value above.&lt;/P&gt;

&lt;P&gt;For instance, I am running this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search
| bucket _time span=1d
| stats latest(_time) AS LatestTime, earliest(_time) AS EarliestTime by uniqueID
| eval delayDays=(NOW()-LatestTime)/60/60/24
| eval dead=if((delayDays&amp;gt;20),1,0)
| eval lifeLength=(LatestTime - EarliestTime)/60/60/24
| chart count(eval(dead=0)) as "numberAlive", count(eval(dead=1)) as "numberDead" by lifeLength span=1
| eval sumOfDeadAlive=numberAlive+numberDead
| eventstats sum(sumOfDeadAlive) as sumOfDeadAlive
| eval survivalRate = (sumOfDeadAlive - numberDead)/(sumOfDeadAlive)
| streamstats list(survivalRate)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;This will return something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;lifeLength  numberAlive  numberDead  list(survivalRate)  sumOfDeadAlive survivalRate
0-1              13         249           0.674935           766           0.674935

1-2               1           3           0.674935           766           0.996084
                                          0.996084

2-3               0           0           0.674935           766          1
                                          0.996084
                                          1
etc
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a way to multiply each result in the "list(survivalRate)" together? Maybe an eval command I do not know? Or can you use mvexpand to expand the results into columns somehow instead of new rows?&lt;/P&gt;

&lt;P&gt;EDIT:&lt;BR /&gt;
I would like to add a column that shows the runningSurvivalRate.&lt;BR /&gt;
In a perfect world it would be like running streamstats product(survivalRate) if that function existed (similar to sum(survivalRate) where instead of adding each result, it multiplies each result)&lt;/P&gt;

&lt;P&gt;In the example above, the running survival rate would be like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; lifeLength  numberAlive  numberDead  list(survivalRate)  sumOfDeadAlive survivalRate  runningSurvivalRate
 0-1              13         249           0.674935           766           0.674935           0.674935

 1-2               1           3           0.674935           766           0.996084           0.67229(0.674935*0.996084)
                                           0.996084

 2-3               0           0           0.674935           766          1           0.67229(0.674935*0.996084*1)
                                           0.996084
                                           1
 etc
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jul 2015 22:41:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132933#M36295</guid>
      <dc:creator>Amohlmann</dc:creator>
      <dc:date>2015-07-22T22:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to multiply all numbers in a multivalue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132934#M36296</link>
      <description>&lt;P&gt;Could you be more specific as to how you'd like your final result be calculated, independent of Splunk SPL?&lt;/P&gt;

&lt;P&gt;To me it looks like your sample data doesn't match the search provided, so I'm confused about your intentions.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 23:20:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132934#M36296</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-07-22T23:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to multiply all numbers in a multivalue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132935#M36297</link>
      <description>&lt;P&gt;Sorry, updated for clarity.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 23:37:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132935#M36297</guid>
      <dc:creator>Amohlmann</dc:creator>
      <dc:date>2015-07-22T23:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to multiply all numbers in a multivalue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132936#M36298</link>
      <description>&lt;P&gt;Okay, using that clarification I'd get rid of this mv field altogether and do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  ...
| eval sumOfDeadAlive=numberAlive+numberDead
| eventstats sum(sumOfDeadAlive) as sumOfDeadAlive
| streamstats sum(numberDead) as sumOfDead
| eval survivalRate = (sumOfDeadAlive - sumOfDead)/(sumOfDeadAlive)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This slightly shuffles around the existing parts of the search, without getting into mv fields.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2015 23:45:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132936#M36298</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-07-22T23:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to multiply all numbers in a multivalue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132937#M36299</link>
      <description>&lt;P&gt;This is pretty close. But mathmatically not quite the same. I really do need to multiply the result of row 1 with row 2, then the result of that with row 3, and that with the result of row 4 etc.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2015 00:17:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132937#M36299</guid>
      <dc:creator>Amohlmann</dc:creator>
      <dc:date>2015-07-23T00:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to multiply all numbers in a multivalue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132938#M36300</link>
      <description>&lt;P&gt;Then I don't understand the meaning of your survivalRate &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Basic example: Half dies on the first day, the other half dies on the second day. First-day-survivalRate is 0.5, obviously. Using your multiplication, the second-day-survivalRate is 0.25... which is where I'm confused. 100% is dead, 50% died during the second day, how is the survival rate 0.25?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2015 20:14:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132938#M36300</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2015-07-23T20:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to multiply all numbers in a multivalue field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132939#M36301</link>
      <description>&lt;P&gt;You are 100% right. I had my math wrong in my head. Thank you for fixing me up.&lt;BR /&gt;
Marking your answer as correct.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2015 22:10:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-multiply-all-numbers-in-a-multivalue-field/m-p/132939#M36301</guid>
      <dc:creator>Amohlmann</dc:creator>
      <dc:date>2015-07-23T22:10:27Z</dc:date>
    </item>
  </channel>
</rss>

