Splunk Search

alternate approach like addtotals function in splunk

khannasunil
New Member

Hi can someone provide me the alternate approach the same addtotals command perform.

I am having below query , here i am sorting the result based on addtotals field :
This query display the result with addtotals field("Total for App"), but i want to get rid out of this field but the behavior and result should be the same in chart.Means in chart it should not display the "Total for App" field.

index=XYZIndex| eval Packets = (s2c_pkts+c2s_pkts) | rename app as App, sip as "Source IP"| chart sum(Packets) as "Total Packets" by App, "Source IP" |addtotals fieldname="Total for App" | sort -"Total for App" | head 10

Thanks,

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Try this

index=XYZIndex| eval Packets = (s2c_pkts+c2s_pkts) | rename app as App, sip as "Source IP"| chart sum(Packets) as "Total Packets" by App, "Source IP" |addtotals fieldname="Total for App" | sort -"Total for App" | head 10| fields - "Total for App"
0 Karma

somesoni2
SplunkTrust
SplunkTrust

I have added a "fields -" command to exclude the field. Have you tried it?

0 Karma

khannasunil
New Member

What is this? same cut copy paste..

Let me elaborate more..

I do not want that addtotals field is appear in my chart , and result should be same ....how can i achieve that ??

0 Karma
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 ...