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!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...