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!

.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 ...