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!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...