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
Revered Legend

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
Revered Legend

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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...