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!

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...