Google Cloud Platform billing metricset
billing 指标集旨在从 Google Cloud BigQuery 日账单详细信息表中收集账单指标。BigQuery 是一个完全托管的无服务器数据仓库。Cloud Billing export to BigQuery 使您能够全天自动将标准和详细的 Google Cloud 账单数据(如使用情况、成本估算和定价数据)导出到您指定的 BigQuery 数据集中。然后,您可以使用 Metricbeat 从 BigQuery 访问您的 Cloud Billing 数据进行详细分析。有关如何导出账单数据的更多详细信息,请参阅 将 Cloud Billing 数据导出到 BigQuery。
在 BigQuery 中,Google Cloud 日账单数据分为两种格式:标准和详细。每种格式都存储在指定的数据集中,并遵循结构化模式以进行精确的成本分析。有关这些格式的全面了解,请参阅 标准和 详细数据模式文档。
对于标准使用情况成本数据,请将表模式格式设置为 gcp_billing_export_v1。当未指定其他格式时,此表模式将设置为默认值。
对于详细使用情况成本数据,请将表模式设置为 gcp_billing_export_resource_v1。详细表包含标准字段以及其他字段,例如 effective_price,从而能够更精细地查看支出。
- dataset_id:(必填) 指向包含实际账单表的顶层容器的数据集 ID。
- table_pattern:(可选) 日账单详细信息表名称前缀。默认为
gcp_billing_export_v1。 - cost_type:(可选) 此行项目代表的成本类型:regular(常规)、tax(税费)、adjustment(调整)或 rounding error(舍入误差)。默认为
regular。
- module: gcp
metricsets:
- billing
period: 24h
project_id: "your project id"
credentials_file_path: "your JSON credentials file path"
dataset_id: "dataset id"
table_pattern: "table pattern"
cost_type: "regular"
有关指标集中每个字段的描述,请参阅 导出的字段部分。
以下是此 metricset 生成的文档示例:
{
"@timestamp": "2017-10-12T08:05:34.853Z",
"cloud.account.id": "01475F-5B1080-1137E7",
"cloud.project.id": "elastic-bi",
"cloud.project.name": "elastic-containerlib-prod",
"cloud.provider": "gcp",
"event": {
"dataset": "gcp.billing",
"duration": 115000,
"module": "gcp"
},
"gcp": {
"billing": {
"billing_account_id": "01475F-5B1080-1137E7",
"cost_type": "regular",
"invoice_month": "202106",
"project_id": "containerlib-prod-12763",
"project_name": "elastic-containerlib-prod",
"total": 4717.170681,
"sku_id": "0D56-2F80-52A5",
"service_id": "6F81-5844-456A",
"sku_description": "Network Inter Region Ingress from Jakarta to Americas",
"service_description": "Compute Engine",
"effective_price": 0.00292353,
"tags": [
{
"key": "size",
"value": "standard"
}
]
}
},
"metricset": {
"name": "billing",
"period": 10000
},
"service": {
"type": "gcp"
}
}