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!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...