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!

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...