Splunk Search

Average command vs count and average command

ranjitbrhm1
Communicator

Maybe im just bad in mathematics. but why does splunk docs always take the count of events and then the avg of events (stats count(events) | stats avg(events) instead of stats avg events directly?

can someone please explain the logic to me?

0 Karma
1 Solution

TISKAR
Builder

Hello,

The avg function applie to number field avg(event) the event is number, you can apply avg directly to the field that have the number value without use stats count, and when you use | stats count | stats avg the avg look only to the result give by stats count
For example:

 stats count as a by field | stats avg(a) 

can you share the link of docs please

Regards

View solution in original post

TISKAR
Builder

Hello,

The avg function applie to number field avg(event) the event is number, you can apply avg directly to the field that have the number value without use stats count, and when you use | stats count | stats avg the avg look only to the result give by stats count
For example:

 stats count as a by field | stats avg(a) 

can you share the link of docs please

Regards

FrankVl
Ultra Champion

Can you provide a link to an example of that? The way you quoted it here it doesn’t make too much sense to me...

Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...