Splunk Search

Adding a row of Totals

raby1996
Path Finder

Hi all, currently I'm using a search

Which gives me something like this for each group/event

 Group           Bundle             Installs        MM     Total_Installs     Totals_MM
 1                  1a                 3            50           10               80  
                    2a                 2            20      
                    3a                 5            10
 ____________________________________________________________________________

However i was wondering if i could change it so that i get something like this, with the totals as a row at the bottom of the event

  Group           Bundle             Installs        MM     
       1                1a                  3            50                        
                        2a                  2            20      
                        3a                  5            10

 Group_1_Totals                            10            80

Is there any way i can do this? I tried using the addcoltotals and addtotals commands but they didn't seem to work, thank you!

0 Karma
1 Solution

somesoni2
Revered Legend

Just something like this to end of you search. Since the appendpipe below will give you total already, you can remove the code to calculate in your previous stats)

Your current search giving  results by Group |  appendpipe [| stats sum(Field1) as Field1 sum(Field2) as Field2..List all fields which you want to sum... by Group ] | sort Group

View solution in original post

somesoni2
Revered Legend

Just something like this to end of you search. Since the appendpipe below will give you total already, you can remove the code to calculate in your previous stats)

Your current search giving  results by Group |  appendpipe [| stats sum(Field1) as Field1 sum(Field2) as Field2..List all fields which you want to sum... by Group ] | sort Group

raby1996
Path Finder

hmmm its close but its giving me the totals in a different column, is there any way to make this appear directly under the field?

0 Karma

somesoni2
Revered Legend

It will show under the same field if you've correctly done the renaming in the stats within appendpipe.

| stats sum(Field1) as Field1 will give total of all values of Field1 and list it under Field1 only.

If you don't mind, could you paste the query that your tried?

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...