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 | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...