07 Feb 2024 08:37 PM - last edited on 08 Feb 2024 08:12 AM by MaciejNeumann
I was trying to figure out about how many host-unit-hrs I was paying for non-prod hosts.
fetch dt.entity.host
| fieldsAdd entity.type, entity.name, lifetime, tags, hypervisorType, memoryTotal, physicalMemory, paasMemoryLimit
| filterOut in(tags, array("[AWS]environment:prod", "environment-custom:prod"))
| fieldsAdd ts_30d_ago=now()-30d
| fieldsAdd start_ts=arrayMax(array(ts_30d_ago, toTimestamp(lifetime[start]))), end_ts=toTimestamp(lifetime[end])
| fieldsAdd hrs=ceil(toLong(end_ts-start_ts)/1000000000/60/60.0)
| fieldsRemove start_ts, end_ts
| fieldsAdd gb=if(paasMemoryLimit>0, paasMemoryLimit*1024*1024, else: memoryTotal)/1024/1024/1024.0
| fieldsAdd gb_hrs=gb*hrs
| summarize sum(gb_hrs), alias:total_gb_hrs
| fieldsAdd host_unit_hrs=total_gb_hrs/8
I ran the above query for 30d and it took 25sec. But it said "Scanned bytes: 0 B" so I wasn't sure how expensive this query was in overall license cost.
Is there a general way to estimate license cost for a given query?
Solved! Go to Solution.
08 Feb 2024 10:01 PM
Smartscape queries (dt.entity.host in your case) are not subject to cost and are free.