Splunk Search

Average of ratio of two fields?

travispowell
Path Finder

in source X, I have fields A and B. I want to find the average ratio of two fields per hour. Something like:

source=X * | stats avg(eval(A/B)) by date_hour

...which obviously doesn't work. It says I need to rename something or rather...

Tags (2)
1 Solution

Ron_Naken
Splunk Employee
Splunk Employee

Have you tried it like this:

source=X * | eval ratio=A/B | stats avg(ratio) by date_hour

View solution in original post

Ron_Naken
Splunk Employee
Splunk Employee

Have you tried it like this:

source=X * | eval ratio=A/B | stats avg(ratio) by date_hour

travispowell
Path Finder

I feel like I do this so often. Yes I did try that, but you reminded me I needed to capitalize the fields. I'm positive splunk is case-sensitive.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...