Splunk Search

Index data volume for logs older than a year

balbano
Contributor

Hi,

Can someone tell me how to run a query that will return the size (MB) of total index volume for all logs that are older than a year? I'd like to plan to modify my retention policy to keep logs for 1 year before removing from the index.

Let me know.

Thanks.

Brian

Tags (3)
0 Karma

joshd
Builder

Run this search:

index=_internal source=*metrics.log group=per_index_thruput series!=_* | eval totalGB = (kb/1024)/1024 | stats sum(totalGB)

And choose from the time drop down "Previous Year" or choose "Custom Time" and click "earliest date" then set the appropriate date to search up until. This will give you a total of the GB indexed.

0 Karma

joshd
Builder

There should be no issue with this search.. can you run the search over a recent period of time to make sure it returns some results? Just to verify it's indexing the internal metric properly.

Take a peak at my blog post for some relevant searches that may be of assistance:

http://www.joshd.ca/content/splunk-usage-statistic-searches

0 Karma

balbano
Contributor

Thanks for the tip Josh. However, this produced no results for me. Anything else I might be able to try? I know for sure I have data older than a year.

0 Karma
Get Updates on the Splunk Community!

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 ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...