Splunk Search

How to search for average data indexed over 30, 60, 90 days by index?

matthew_foos
Path Finder

Splunkers,

Looking for a search string that will allow me to use the time picker to see how much data has been indexed over 30, 60, 90, etc days by index. I tried a few searches but had no luck.

Any help would be greatly appreciated.

Thanks

0 Karma
1 Solution

althomas
Communicator

So this is an example over three days, but this should vaguely work for your purposes. I've only focused on one index for demonstrative purposes.

Change hours to months (-3mon@mon and @mon) or 30 days (-90d@d, @d, bin _time span=30d) for this to work

index=_internal source=*license_usage.log* idx=my_index earliest=-3h@h latest=@h
| bin _time span=1h
| stats sum(b) as bytes by idx, _time
| reverse
| streamstats sum(bytes) as total_bytes by idx
| timechart values(total_bytes) by idx span=1h

Hope this helps!

Edit: Used accum instead of streamstats -- this should work now.

View solution in original post

0 Karma

althomas
Communicator

So this is an example over three days, but this should vaguely work for your purposes. I've only focused on one index for demonstrative purposes.

Change hours to months (-3mon@mon and @mon) or 30 days (-90d@d, @d, bin _time span=30d) for this to work

index=_internal source=*license_usage.log* idx=my_index earliest=-3h@h latest=@h
| bin _time span=1h
| stats sum(b) as bytes by idx, _time
| reverse
| streamstats sum(bytes) as total_bytes by idx
| timechart values(total_bytes) by idx span=1h

Hope this helps!

Edit: Used accum instead of streamstats -- this should work now.

0 Karma

matthew_foos
Path Finder

index=_internal source=license_usage.log idx=* | bin _time span=1d | stats sum(b) as bytes by idx, _time | stats avg(bytes) as bytes by idx | eval GB = round(bytes/1024/1024/1024, 4) | eval MB = round(bytes/1024/1024, 4) | table idx, GB, MB | rename idx as Index, GB as "Average GB Indexed per Day", MB as "Average MB Indexed per Day"

This ended up being my solution.

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Can you share what you've tried?

0 Karma
Get Updates on the Splunk Community!

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

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...