Splunk Search

alternate approach like addtotals function in splunk

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

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

SplunkTrust
SplunkTrust

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

0 Karma

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