Splunk Search

How to Calculate the product of a numeric field (multiplication)?

khayamgondal
Engager

I have a field with the following values. How can I calculate the product i.e multiply all values with each other? There is a sum function but no multiplication. The output should be = 0.1*0.03*0.34*0.32. Thanks 

0.1

0.03

0.34

0.32

Labels (3)
0 Karma

somesoni2
Revered Legend

Will something like this work for you?

| makeresults | eval t="0.1 0.03 0.34 0.32" | makemv t | mvexpand t 
| streamstats count | eval count="TTT".count | xyseries _time count t | eval multiply=1 | foreach TTT* [| eval multiply=multiply*'<<FIELD>>'] | table multiply

 (first line to generate sample data). 

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...