Splunk Search

Including a total line for stats by X

brettcave
Builder

hi, i use stats for a lot of reports, generally using a "by" clause. Is there a way to generate a summary line for stats? For my specific use case, I want to do a sum of a column:

... | stats sum(something) as TotalSomething by category 

That will give:

category    TotalSomething
x           100
y           200

How do I add:

Total       300

To the report?

Tags (2)
1 Solution

kristian_kolb
Ultra Champion

... | addcoltotals label=Total labelfield=category

could that be what you're looking for?

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Addcoltotals

/K

View solution in original post

kristian_kolb
Ultra Champion

... | addcoltotals label=Total labelfield=category

could that be what you're looking for?

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Addcoltotals

/K

brettcave
Builder

perfect. thank you. So many functions. So little time.

0 Karma

skpuli
New Member

addcoltotal giving me total with out total label . How can i add label to display like total = 10,20,30

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 ...