Splunk Search

Sum Total File Size By Year

caviman2201
Path Finder

I have the following data:

Time FileName FileSize
5/4/2010 stuff.txt 151
7/15/2010 whatever.txt 252
6/5/2011 things.txt 353
6/7/2012 yes.txt 454
8/5/2012 no.txt 555
9/10/2013 blah.txt 656



What I need is an output showing the number of files from each year and the total size of files from that year. I got the first part by doing:

index=temp_index | stats count by date_year

This outputs:

Date_Year Count
2010 2
2011 1
2012 2
2013 1



What I need is a third column that adds the total file sizes for each year so:

Date_Year Count TotalFileSize
2010 2 403
2011 1 353
2012 2 1009
2013 1 656
Tags (3)
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Try this:

index=temp_index | stats count sum(FileSize) by date_year

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

Try this:

index=temp_index | stats count sum(FileSize) by date_year
Get Updates on the Splunk Community!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...