Splunk Search

To compare today's Index size with yesterday's

VijaySrrie
Builder

I use the below query to find the index size, how can I modify the query to get the comparision between todays's index size with yesterday's?

| eventcount summarize=false index=* report_size=true | eval MB=(size_bytes/1024)/1024 | stats sum(MB) by index, server

Tags (1)
0 Karma

VijaySrrie
Builder

When I tried to change the label with GB I am not getting the percentage value.

index=_internal source=license_usage.log type=Usage earliest=-2d@d latest=@d
| eval Day=if(_time

0 Karma

VijaySrrie
Builder

Hi,

When I tried to change the label with GB I am not getting the percentage value.

index=_internal source=license_usage.log type=Usage earliest=-2d@d latest=@d
| eval Day=if(_time

0 Karma

VijaySrrie
Builder

Hi Mayur,

In dashboard I think the yesterday's count is showing as day b4 yesterday's count and vice versa. How to change the lable? need to add GB to the label, and has to be rounded off to 2 digits

0 Karma

mayurr98
Super Champion

you can change the label @ | eval Day=if(_time<relative_time(now(),"-1d@d"),"Yesterday","Day_Before_Yesterday") this level.

and add to get the results in GB

| stats sum(eval(round((b/1024)/1024/1024,2))) AS volume_b by idx Day
0 Karma

VijaySrrie
Builder

Thank you. Is it possible to find the difference between the two datas and showing the % change?

0 Karma

mayurr98
Super Champion

Yes absolutely,

here you go:

index=_internal source=*license_usage.log* type=Usage earliest=-2d@d latest=@d 
| eval Day=if(_time<relative_time(now(),"-1d@d"),"Yesterday","Day_Before_Yesterday") 
| stats sum(eval((b/1024)/1024)) AS volume_b by idx Day 
| chart max(volume_b) over idx by Day | eval %change=((Yesterday-Day_Before_Yesterday)/Yesterday)*100

If this helps you, accept the answer to close this question

0 Karma

mayurr98
Super Champion

Hi

Could you pls try this ?

index=_internal source=*license_usage.log* type=Usage earliest=-1d@d latest=now 
| eval Day=if(_time<relative_time(now(),"@d"),"Yesterday","Today") 
| stats sum(eval((b/1024)/1024)) AS volume_b by idx Day 
| chart max(volume_b) over idx by Day

let me know if this helps!

0 Karma

VijaySrrie
Builder

yes, it is working but it shows only 14 indexes, we have may.

0 Karma

VijaySrrie
Builder

May I know the query for yesterday and day before yesterday?

0 Karma

mayurr98
Super Champion

well, eventcount considers the summary from the beginning and not counting on daily basis that is why my query focus on the specific period you are looking for so you won't see the indexes which ain't contributing to license usage within specified period.

here you go:

index=_internal source=*license_usage.log* type=Usage earliest=-2d@d latest=@d 
| eval Day=if(_time<relative_time(now(),"-1d@d"),"Yesterday","Day_Before_Yesterday") 
| stats sum(eval((b/1024)/1024)) AS volume_b by idx Day 
| chart max(volume_b) over idx by Day
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...