Splunk Search

Summing the row

vinay_ks04
New Member

Colum A Column B
1 1
2 2
2 3
2 4
5 5

I wanted to sum columnB but on condition. Below is the example

(Column A) - 1 (Sum of Column B) 1
(Column A) - 2 (Sum of Column B) 2 + 3 + 4 = 9

Tags (2)
0 Karma

gfuente
Motivator

Hello

I think you can use eventstats like:

...| eventstats sum(ColumnB) as Total by ColumnA | ...

Try it and let me know

Regards

0 Karma

gfuente
Motivator

The same but with both fields in the by:
...| eventstats sum(ColumnB) as Total by Site, ConfigID | ...

0 Karma

vinay_ks04
New Member

Hi,

I have used for my another column.

there are three columns

Site ConfigID TaskCount
BAN 1 1
2 2
3 4
5 5
MYS 1 1
1 2
3 4
4 5
4 6

I have used your menthod for consolidating with site wise.
Kindly let me know for summing of taskcounts of same configids.

0 Karma
Get Updates on the Splunk Community!

The OpenTelemetry Certified Associate (OTCA) Exam

What’s this OTCA exam? The Linux Foundation offers the OpenTelemetry Certified Associate (OTCA) credential to ...

From Manual to Agentic: Level Up Your SOC at Cisco Live

Welcome to the Era of the Agentic SOC   Are you tired of being a manual alert responder? The security ...

Splunk Classroom Chronicles: Training Tales and Testimonials (Episode 4)

Welcome back to Splunk Classroom Chronicles, our ongoing series where we shine a light on what really happens ...