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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...