Filtering¶
When querying using the lists endpoints
- POST
/api/consumptionlog/log/list
- POST
/api/consumptionlog/log/my-list
There are multiple options that can optionally be used to filter the results for the logs that are retrieved:
from
: Will retrieve logs with a ValidFrom that is greater than this dateto
: Will retrieve logs with a ValidTo that is less than this dateprojectId
: Retrieves from a specific projectoperationId
: Retrieves for a particular operationmetricType
: Only retrieves for a particular metric, i.e.StorageUsage
,ComputeTime
, andTotalStorageUsage
resourceId
: Retrieves for a particular resource, e.g.compute.azure.VM-S-5
andstorage.azure.multidimensional-HotStorage
billingReference
: Retrieves for a particular billing reference.billingReferenceTag
: Retrieves all logs with the specified tag
Aggregation¶
On top of the filter options above deciding which logs gets retrieved there are some aggregation options that can be used to aggregate the data across various attributes.
This is represented in the body of the query as follows with the possible values indicated in the values and separated by |
when there are more than one:
{
...,
"aggregateBy": {
"Time": "all|day",
"ProjectId": "all",
"ResourceId": "all",
"OperationId": "all",
"BillingReference": "all|billingReference|tag"
},
...
}
all
means that the attribute will be fully aggregated and will appear in the output with a null
value. For Time day
means that daily aggregations will be returned. Finally billing reference can be aggregated both by the actual reference as well as the tag attached to it.
Sorting¶
Sorting is also available for a single attribute and can be done both ascending and descending. It is represented by two fields in the body of the request:
{
...,
"sortBy": "Id|TenantId|ProjectId|MetricType|OperationId|ValidFrom|ValidTo|Value",
"sortOrder": "Asc|Desc",
...
}
Paging¶
Finally, you can get the results paged, as you can set the properties offset
and limit
, where limit
sets how many results are returned while offset
sets where in the list the query starts.