Splunk Search

sum of all the fields and aggregate sum

shrirangphadke
Path Finder

Hi,

I am having a tough time in creating overall sum and aggregate sum. Here is my issue:

I have multiple values between client-server:

source destination client_to_server_bytes server_to_client_bytes
    A --   B                10                                   12
    A --   B                10                                   10
    A --   C                50                                   30
    C --   D                15                                   15
    c --   D                10                                   10

I want to create a table with addition of two values in all occurrences. And final value would have addition of all the additions:

A -- B 42
A -- C 80
C -- D 50

To get first addition I did:

my_search ... | eval total_bytes = exact(val_1 + val_2) | table source destination total_bytes

This correctly gave me following result:

A -- B 22
A -- B 20
...and so on

Now how do I combine them to form a single result?

0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

 my_search ... | eval total_bytes = exact(val_1 + val_2) | stats sum(total_bytes) by source destination

View solution in original post

woodcock
Esteemed Legend

Like this:

 my_search ... | eval total_bytes = exact(val_1 + val_2) | stats sum(total_bytes) by source destination

shrirangphadke
Path Finder

very true !

0 Karma

shrirangphadke
Path Finder

It was easy! I am really dumb.. Anyways Thanks for your help !!

0 Karma

woodcock
Esteemed Legend

So am I but Splunk makes even dummies look brilliant!

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...