Splunk Search

Splunk query for sum of fields

NAVEEN_CTS
Path Finder

Hi

i have a field A B C D
for example with following data
A B C D
1 2 3 4
1 2 2 3
2 3 3 4

I want a result "total" = Sum(A) + Sum(B)+ Sum(C) + Sum(D)
total = 4 + 7 + 8 +11
total = 30

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@NAVEEN_CTS

Can you please try this?

YOUR_SEARCH | stats sum(*) as * | addtotals

Sample Search:

| makeresults count=4 | eval A=1 | accum A | eval B=A,C=A,D=A | stats sum(*) as * | addtotals
Get Updates on the Splunk Community!

Join Us at the Builder Bar at .conf24 – Empowering Innovation and Collaboration

What is the Builder Bar? The Builder Bar is more than just a place; it's a hub of creativity, collaboration, ...

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...

Everything Community at .conf24!

You may have seen mention of the .conf Community Zone 'round these parts and found yourself wondering what ...