Splunk Search

how to ignore a column using addtotals/addcoltotals

mjhamm75
New Member

Here is my search

index="aries" splunk tt=HL7* | 
chart count by si , tt | 
addtotals |
addcoltotals|
rename si as GenKey | 
rename count as Count

My GenKey/si is is an identifying number. I do not want to add the identifier into my totals, nor do I want a column total of the identifer. How do I ignore the identifier and just add the pertinent data from the table?

0 Karma

sjbriggs
Path Finder

I was searching for a solution to the same problem all morning and finally found that I can just specify which fields I want to have in the "Total" column:

|stats sum(GB_in) AS "GB IN", sum(GB_out) AS "GB OUT" by category |addtotals "GB IN" "GB OUT" |sort -Total

Tags (3)
0 Karma

ManiKandanS
New Member

|addtotals label=total labelfiled=field which you want to remove

0 Karma

lguinn2
Legend

I prefer eval to addtotals

eval total=field1 + field2 + field3

Instead of addcoltotals, use the addtotals command with the col option

addtotals col=true field1 field2 field3

BUT, you may have a more fundamental problem. After the second line of your command, you have only 3 fields available in the pipeline: count, si, tt. If that's what you want, then okay. The chart command is also making things weird, so I used the stats command instead

index="aries" splunk tt=HL7* | 
stats count by si , tt | 
eval total = count + tt|
addcoltotals col=t total count tt|
rename si as GenKey | 
rename count as Count
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...