Splunk Cloud

Search Reference

Download manual as PDF

Download topic as PDF



The addcoltotals command appends a new result to the end of the search result set. The result contains the sum of each numeric field or you can specify which fields to summarize. Results are displayed on the Statistics tab. If the labelfield argument is specified, a column is added to the statistical results table with the name specified.


addcoltotals [labelfield=<field>] [label=<string>] [<fieldlist>]

Optional arguments

Syntax: <field> ...
Description: A space delimited list of valid field names. The addcoltotals command calculates the sum only for the fields in the list you specify. You can use the asterisk ( * ) as a wildcard in the field names.
Default: Calculates the sum for all of the fields.
Syntax: labelfield=<fieldname>
Description: Specify a field name to add to the result set.
Default: none
Syntax: label=<string>
Description: Used with the labelfield argument to add a label in the summary event. If the labelfield argument is absent, the label argument has no effect.
Default: Total


Example 1:

Compute the sums of all the fields, and put the sums in a summary event called "change_name".

... | addcoltotals labelfield=change_name label=ALL

Example 2:

Add a column total for two specific fields in a table.

sourcetype=access_* | table userId bytes avgTime duration | addcoltotals bytes duration

Example 3:

Filter fields for two name-patterns, and get totals for one of them.

... | fields user*, *size | addcoltotals *size

Example 4:

Augment a chart with a total of the values present.

index=_internal source="metrics.log" group=pipeline |stats avg(cpu_seconds) by processor |addcoltotals labelfield=processor

See also

addtotals, stats


Have questions? Visit Splunk Answers and see what questions and answers the Splunk community has using the addcoltotals command.


This documentation applies to the following versions of Splunk Cloud: 6.6.3, 7.0.2, 7.0.3, 7.0.0, 7.0.5, 7.0.8, 7.0.11, 7.1.3, 7.1.6, 7.2.3, 7.2.4, 7.2.6, 7.2.7, 7.2.8, 7.2.9, 8.0.0, 8.0.1


Is there a way to highlight (bold) the addcoltotals results.

June 18, 2014

During the interactive aggregation phase of charting, the presumed left-hand label column may float rightward in the table (presumably due to the fact that a simple alphanumeric string sort puts other columnt headints before the label column). On completion of the search the label column snaps back to its correct position.

May 23, 2012

Was this documentation topic helpful?

Enter your email address, and someone from the documentation team will respond to you:

Please provide your comments here. Ask a question or make a suggestion.

You must be logged into splunk.com in order to post comments. Log in now.

Please try to keep this discussion focused on the content covered in this documentation topic. If you have a more general question about Splunk functionality or are experiencing a difficulty with Splunk, consider posting a question to Splunkbase Answers.

0 out of 1000 Characters