Splunk Search

Running Total

Michael_Schyma1
Contributor

I am trying to get a running total for the number of events field. I can not get a column that adds up every 'number of events' or a running total anywhere at the bottom. Any Suggestions??

Heres my search:

*- fields + app_name, app_id |top app_id app_name |rename app_id AS "App Code" app_name AS "Application Name" count AS "Number of Events" percent AS "Percent"

Tags (3)
0 Karma
1 Solution

Ayn
Legend

From the docs on accum:

accum
Keeps a running total of a specified numeric field.

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Accum

View solution in original post

Ayn
Legend

From the docs on accum:

accum
Keeps a running total of a specified numeric field.

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Accum

rturk
Builder

Nice! Another command that I wasn't previously aware existed 🙂

0 Karma

rturk
Builder

Just as a suggestion, this search does a count for events with two distinct values, adds them together, and has the total as a new column.

 | stats count(eval(product="abc")) AS abc_count, count(eval(product="xyz")) AS xyz_count by product | eval total_products=abc_count+xyz_count  | sort -total_products

Sorry if this isn't what you're looking for, but hopefully it helps in some way.

Also you might want to remove the regex tag.. I don't think this has much to do with regular expressions 😉

0 Karma

Michael_Schyma1
Contributor

Sorry about that, i am not sure how that got there.

0 Karma

Michael_Schyma1
Contributor

so there is no way to just add a field that will give me a running total for all the events that I am searching for. When i add the sum feature it just takes me to a different screen and then gives me a total instead of having all the information listed and totaling in a different field. Thank you for your help, just having a hard time getting it to work.

0 Karma

Michael_Schyma1
Contributor

yes, but it does not add a seperate column that just has the total of all the counts

0 Karma

Drainy
Champion

so you need to use a | stats sum(count) ?

Michael_Schyma1
Contributor

They are existing fields, I need a total of the top events. Not just each individual event

0 Karma

Drainy
Champion

What about the part that generates the statistics? (the count and percent part) unless they are existing fields?

0 Karma

Michael_Schyma1
Contributor

Just a portion of it.. I left off the index and the sourcetype because i didnt think it would be needed.

0 Karma

Drainy
Champion

+1 Ayn, you'll need to copy and paste your whole search directly if you want any useful help.

0 Karma

Ayn
Legend

I doubt that is really your search. Did you paste the whole search or just portions of it?

Michael_Schyma1
Contributor

any help would be appreachated

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Data Management Digest – May 2026

Welcome to the May 2026 edition of Data Management Digest!   As your trusted partner in data innovation, the ...

Index This | What is feather-light but cannot be held long?

May 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

.conf26 Registration is Live: Secure Your Early Bird Pass Now

  Lock in Your Spot: Registration Open for .conf26 in Denver Hello Splunkers, I have exciting news! Your ...