Splunk Search

Computing average request time with mvcount fields and numerical field values

ericrobinson
Path Finder

Hello,

Is it possible to compute an average of the numerical field by dividing it by the mvcount field I am defining?

I have a field foo whose value is numeric. I have another field bar_count whose value is numeric and is the mvcount of a multivalue field.

For each event, I want to chart the average:

... | chart eval(foo/bar_count) as average_tran
Tags (1)
0 Karma

gkanapathy
Splunk Employee
Splunk Employee

You can either:

... | eval f=foo/bar_count | chart first(f) as average_tran

or

... | chart first(eval(foo/bar_count)) as average_tran

You need an aggregator with chart (in this case, first()) as it must be told how to resolve the possibility of multiple values.

I do question why you are charting what will come out as a single value here though, but I assume that you're simplifying somewhat and that your real chart command has a split-by field. Otherwise, you can really just skip the chart command entirely.

ericrobinson
Path Finder

Thank you!! You have helped me several times in the last few days..

0 Karma
Get Updates on the Splunk Community!

Observability Highlights | January 2023 Newsletter

 January 2023New Product Releases Splunk Network Explorer for Infrastructure MonitoringSplunk unveils Network ...

Security Highlights | January 2023 Newsletter

January 2023 Splunk Security Essentials (SSE) 3.7.0 ReleaseThe free Splunk Security Essentials (SSE) 3.7.0 app ...

Platform Highlights | January 2023 Newsletter

 January 2023Peace on Earth and Peace of Mind With Business ResilienceAll organizations can start the new year ...