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!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...