Splunk Search

Search to shows results for the past 30 days?

kteng2024
Path Finder

Can I please get help to modify the below query to display results of each day for last 30 days which will show the rawtotal diskTotal compression

| dbinspect index=webserver_index
| fields state,id,rawSize,sizeOnDiskMB,index,splunk_server
| stats sum(rawSize) AS rawTotal, sum(sizeOnDiskMB) AS diskTotalinMB by index splunk_server | eval diskTotalinGB=round(diskTotalinMB/1024,2)
| eval rawTotalinGB=round(rawTotal/(1024*1024*1024),2) | fields - rawTotal
| eval compression=tostring(100-round(diskTotalinGB / rawTotalinGB * 100, 2)) + "%"
| table index, splunk_server, rawTotalinGB, diskTotalinGB, compression | addcoltotals rawTotalinGB diskTotalinGB labelfield=splunk_server label="Total Usage(GB)"
0 Karma

somesoni2
SplunkTrust
SplunkTrust

Give this a try (may not be the faster search you will see)

| dbinspect index=webserver_index span=1h | untable _time bucket count | dedup bucket | rex field=bucket "(?<state>\w+)-(?<id>\d+)" | sort 0 -_time | dedup id | join id [| dbinspect index=webserver_index 
| fields state,id,rawSize,sizeOnDiskMB,index,splunk_server] | bucket span=1h _time | stats sum(rawSize) AS rawTotal, sum(sizeOnDiskMB) AS diskTotalinMB by _time index splunk_server | eval diskTotalinGB=round(diskTotalinMB/1024,2)
| eval rawTotalinGB=round(rawTotal/(1024*1024*1024),2) | fields - rawTotal
| eval compression=tostring(100-round(diskTotalinGB / rawTotalinGB * 100, 2)) + "%"
| table _time index, splunk_server, rawTotalinGB, diskTotalinGB, compression | addcoltotals rawTotalinGB diskTotalinGB labelfield=splunk_server label="Total Usage(GB)"

DalJeanis
SplunkTrust
SplunkTrust

@somesoni2 -

This is ugly...

tostring(100-round(diskTotalinGB / rawTotalinGB * 100, 2)) + "%"

This is not....

tostring(100-round(100*diskTotalinGB / rawTotalinGB, 2)) + "%"
0 Karma
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 ...