Azure portal でこれらのクエリを使用する方法については、 Log Analytics のチュートリアルを参照してください。 REST API については、「 Query」を参照してください。
DevCenter - DevBox ストレージとコンピューティング使用量の内訳 (開発ボックス別)
特定の月のストレージとコンピューティング ユニットの合計を取得します。
let startSearchTime = startofmonth(now());
let endSearchTime = startofmonth(now(), 1); // The second parameter represents the number of months to offset from the input date.
DevCenterBillingEventLogs
| where OperationName == "DevBoxUsage"
and StartTime >= startSearchTime
and StartTime < endSearchTime
| summarize arg_min(StartTime, *) by EventId // This will remove any duplicate rows. NOTE: Usages with the same EventId are not double charged, the dupe rows are only related to double logging.
| extend DevBoxName = UsageResourceName
| extend DevBoxId = UsageResourceUniqueId
| summarize StorageHours = countif(UsageType == "Storage"),
StorageMeterQuantity = round(sum(iff(UsageType == "Storage", Quantity, 0.0)), 6),
TotalRunningHours = round(sum(iff(UsageType == "Compute", Quantity, 0.0)), 6),
NormalRateComputeHours = round(sum(iff(UsageType == "Compute" and IsOverMonthlyBillingCap == false, Quantity, 0.0)), 6),
DiscountRateComputeHours = round(sum(iff(UsageType == "Compute" and IsOverMonthlyBillingCap == true, Quantity, 0.0)), 6)
by DevBoxName, DevBoxId
| project-reorder DevBoxName, DevBoxId, StorageHours, StorageMeterQuantity, TotalRunningHours, NormalRateComputeHours, DiscountRateComputeHours
DevCenter - プール別の DevBox 課金メーターの内訳
特定の月のプール別の合計メーター ユニット数を取得します。
let startSearchTime = startofmonth(now());
let endSearchTime = startofmonth(now(), 1); // The second parameter represents the number of months to offset from the input date.
DevCenterBillingEventLogs
| where OperationName == "DevBoxUsage"
and StartTime >= startSearchTime
and StartTime < endSearchTime
| summarize arg_min(StartTime, *) by EventId // This will remove any duplicate rows. NOTE: Usages with the same EventId are not double charged, the dupe rows are only related to double logging.
| extend Pool = tolower(BilledResourceId)
| summarize MeterUsage = round(sum(Quantity), 6)
by Pool, MeterId, UsageType