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!

Index This | Why do they call it hyper text?

November 2023 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

State of Splunk Careers 2023: Career Resilience and the Continued Value of Splunk

For the past three years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

The Great Resilience Quest: 9th Leaderboard Update

The ninth leaderboard update (11.9-11.22) for The Great Resilience Quest is out >> Kudos to all the ...