Archive
Highlighted

Why am I unable to run dbinspect from cli for calculating compression?

Champion

I'd like to run the following search on my indexer to calculate compression. It works in UI, but not in CLI. I have disabled splunkweb on my indexers (as we use a separate search head pool) so I'd like to be able to run it from CLI:

| dbinspect index=_internal
| fields state,id,rawSize,sizeOnDiskMB 
| stats sum(rawSize) AS rawTotal, sum(sizeOnDiskMB) AS diskTotalinMB
| eval rawTotalinMB=(rawTotal / 1024 / 1024) | fields - rawTotal
| eval compression=tostring(round(diskTotalinMB / rawTotalinMB * 100, 2)) + "%"
| table rawTotalinMB, diskTotalinMB, compression
0 Karma
Highlighted

Re: Why am I unable to run dbinspect from cli for calculating compression?

Splunk Employee
Splunk Employee

This is the exact syntax I used from the command line:

/opt/splunk/bin/splunk search '| dbinspect index=_internal
| fields state,id,rawSize,sizeOnDiskMB 
| stats sum(rawSize) AS rawTotal, sum(sizeOnDiskMB) AS diskTotalinMB
| eval rawTotalinMB=(rawTotal / 1024 / 1024) | fields - rawTotal
| eval compression=tostring(round(diskTotalinMB / rawTotalinMB * 100, 2)) + "%"
| table rawTotalinMB, diskTotalinMB, compression' -preview f

View solution in original post

Highlighted

Re: Why am I unable to run dbinspect from cli for calculating compression?

Champion

It worked! Thanks.

0 Karma