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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...