Splunk Search

addcoltotals

nithys
Path Finder

Screenshot 2023-11-03 at 2.22.56 PM.png

 

I have used the below query to get the total from that column
Index="" source=""
| fields queryHits | table queryHits | addcoltotals labelfield=total label="queryHits"...
Now how do i get only the last row which is the total to display in my dashboard.I tried using stats count but its not fetching the correct vaue

 

 

 

Labels (1)
Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

You could just take the last line using tail

index="" source=""
| fields queryHits 
| table queryHits 
| addcoltotals labelfield=total label="queryHits"
| tail 1

but there's a better way to get just the total

Index="" source=""
| stats sum(queryHits) as queryHits

 

---
If this reply helps you, Karma would be appreciated.

nithys
Path Finder

thank you 

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