Splunk Search

How do I sum values inside a multivalue row?

clopes
Engager

Hi all,

I'm trying to create a sum of fields inside a row, but I can't figure how to do it. This is my scenario:

  • I have a table with one line for each transaction.
  • A transaction is composed of single calls (A, B and C).
  • For each call, I have a RequestTime

My actual table:

T          Service    RequestTime A  RequestTime B  RequestTime C
---------------------------------------------------------------------
12 ms         A           3            0              0
               B              0            6              0
               A              3            0              0
               B              0            2              0
               C              0            0              6
---------------------------------------------------------------------
56 ms         A           2            0              0
               B              0            4              0
               A              3            0              0
               B              0            2              0
               C              0            0              1

I want to add 3 more columns with the each RequestTime column sum by row, to be like this:

T          Service    RequestTime A  RequestTime B  RequestTime C  Total_A  Total_B  Total_C
-------------------------------------------------------------------------------------------------
12 ms         A           3            0              0           6        8        6
               B              0            6              0
               A              3            0              0
               B              0            2              0
               C              0            0              6
------------------------------------------------------------------------------------------------
56 ms         A           2            0              0           5        6        1
               B              0            4              0
               A              3            0              0
               B              0            2              0
               C              0            0              1

It's possible to do that?

Thank you

0 Karma

clopes
Engager

I found it:

... | eventstats sum(RequestTime A) as Total_A by Service | eventstats sum(RequestTime B) as Total_B by Service | eventstats sum(RequestTime C) as Total_C  by Service | table ...

somesoni2
Revered Legend

You can still club all three eventstats into one.

... | eventstats sum(RequestTime A) as Total_A by Service | eventstats sum(RequestTime B) as Total_B , sum(RequestTime C) as Total_C  by Service  | table...
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...