Compartilhar via


Consultas para a tabela DevCenterBillingEventLogs

Para obter informações sobre como usar essas consultas no portal do Azure, consulte o tutorial do Log Analytics. Para a API REST, consulte Consulta.

DevCenter – Divisão de uso de computação e armazenamento de DevBox por caixa de desenvolvimento

Obtenha o total de unidades de armazenamento e computação para um determinado mês.

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 – Divisão do medidor de cobrança de DevBox por Pool

Obtenha as unidades totais do medidor por pool por um determinado mês.

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