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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...