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!

.conf24 | Registration Open!

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

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...