Splunk Search

How to average the values of duplicate entries?

crucifier_0
Explorer

Hi,

Suppose I have these following entries in a table

A-  1

A - 2

A - 3

B - 1

B-  2

I want to average the values of the same key. Something like this,

A-  3.5

B - 1.5

Help me out on this 

Labels (4)
Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @crucifier_0,

supposing that the field names in the table are "type" and "value", you should run a search using the stats command, something like this:

your_search
| stats avg(value) AS avg_value BY type

Anyway, I hint to follow the Splunk Search Tutorial at https://docs.splunk.com/Documentation/Splunk/8.2.6/SearchTutorial/WelcometotheSearchTutorial or follow some video tutorial on YouTube.

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @crucifier_0,

supposing that the field names in the table are "type" and "value", you should run a search using the stats command, something like this:

your_search
| stats avg(value) AS avg_value BY type

Anyway, I hint to follow the Splunk Search Tutorial at https://docs.splunk.com/Documentation/Splunk/8.2.6/SearchTutorial/WelcometotheSearchTutorial or follow some video tutorial on YouTube.

Ciao.

Giuseppe

rnowitzki
Builder

Hi @crucifier_0 

Suppose your columns are called "letter" and "number":

| stats avg(number) by letter

 
Hope this is what you asked for.

BR
Ralph

--
Karma and/or Solution tagging appreciated.
Get Updates on the Splunk Community!

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...

Good Sourcetype Naming

When it comes to getting data in, one of the earliest decisions made is what to use as a sourcetype. Often, ...