Splunk Search

How to calculate multiple fields total count?

Min1025
Explorer

I have following fileds, I want to calculate the total f count: (count(f1)+count(f2)+count(f3)+count(f4))=3+3+2+1=9. How can I get the total result 9?

  1. fl=1, f2=3, f3=5
  2. f1=2, f2=2
  3. f1=2, f2=3, f3=3, f4=1
Tags (2)
0 Karma
1 Solution

renjith_nair
Legend

Hi @Min1025,

If you have only these fields as output, you could try

your search|fields "f1,f2,e.t.c." |stats count(*) as *|addtotals

Reference : https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Addtotals

---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

Hi @Min1025,

If you have only these fields as output, you could try

your search|fields "f1,f2,e.t.c." |stats count(*) as *|addtotals

Reference : https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Addtotals

---
What goes around comes around. If it helps, hit it with Karma 🙂

Min1025
Explorer

Thank you, it works.

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...