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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...