This page explains how to view the backup vault consumption logs for the vaulted resources in Cloud Logging. These resources are protected using backup plans. These logs provide insights of the storage consumption details in a backup vault.
Permissions and roles
You need the IAM permission roles/logging.viewer
to view the
backup vault consumption logs. The Logs Viewer
role gives you read-only
access to view backup vault consumption logs of all resources protected
by backup plan in your backup vault project. For more information
about the IAM permissions and roles that apply to
backup vault consumption logs data, see Access control with IAM.
View backup vault consumption logs
You can view backup vault consumption logs in Cloud Logging by using the Google Cloud console and the Google Cloud CLI.
Console
In the Google Cloud console, you can use the Logs Explorer to retrieve the backup vault consumption logs entries for your vaulted resources:
- In the Google Cloud console, go to the Logging > Logs Explorer.
- Select an existing Cloud project.
- In the Query builder pane, select bdr_backup_vault_details from the Select Log name drop-down.
gcloud
The Google Cloud CLI provides a command-line interface to the logging API. To read your backup vault consumption logs entries, run the following command:
gcloud logging read "logName: bdr_backup_vault_details" --project=PROJECT_ID
Replace the following:
PROJECT_ID
: the name of the project where the backup vault is created.
Backup vault consumption log format
Backup vault consumption log entries include the following fields:
Field | Description |
---|---|
backupVaultName |
The relative name of the backup vault that is associated with the source resource. |
sourceResourceName |
The relative name of the source resource. |
minimumEnforcedRetentionDays |
The minimum timeframe in days that backups in that vault are being protected from deletion. |
currentBackupPlanName |
The relative name of the backup plan that is associated with the source resource. |
firstAvailableRestorePoint |
The timestamp when the first (oldest) backup was taken, which is in the YYYY-MM-DDTHH:MM:SS.SSSZ format. |
resourceType |
The type of resource that is protected in a backup vault. |
storedBytesGib |
The amount of storage space consumed by backups in GiB. |
lastAvailableRestorePoint |
The timestamp when the latest backup was taken, which is in the YYYY-MM-DDTHH:MM:SS.SSSZ format. |
The following sample is an example log entry logged on a backup vault test-vault
.
{
"insertId": "6736263559768786491",
"jsonPayload": {
"backupVaultName": "projects/Backupvault_project_ID/locations/asia-east1/backupVaults/test-vault",
"sourceResourceName": "projects/Source_project_ID/zones/asia-east1-c/instances/instance-20240826-175641",
"minimumEnforcedRetentionDays": 1,
"currentBackupPlanName": "projects/Backupvault_project_ID/locations/asia-east1/backupPlans/bp-asia-east1",
"firstAvailableRestorePoint": "2024-10-08T01:10:08Z",
"resourceType": "Compute Engine",
"storedBytesGib": 0.73,
"lastAvailableRestorePoint": "2024-10-08T01:10:08Z",
"@type": "type.googleapis.com/google.cloud.backupdr.logging.v1.BDRBackupVaultDetailsLog"
},
"resource": {
"type": "backupdr.googleapis.com/BackupVault",
"labels": {
"backup_vault_id": "projects/Backupvault_project_ID/locations/asia-east1/backupVaults/test-vault",
"location": "asia-east1",
"resource_container": "236738525349"
}
},
"timestamp": "2024-10-08T08:01:53Z",
"severity": "INFO",
"logName": "projects/project_ID/logs/backupdr.googleapis.com%2Fbdr_backup_vault_details",
"receiveTimestamp": "2024-10-08T08:12:08.404596022Z"
}
Sample queries
To view selected logs, you can write custom queries in the query section.
Use the following query to view consumption details in a backup vault.
logName:"bdr_backup_vault_details" jsonPayload.backupVaultName:"backupVaults/BACKUPVAULT_NAME"
Use the following query to view consumption details using a backup plan.
logName:"bdr_backup_vault_details" jsonPayload.currentBackupPlanName:"backupPlans/BACKUPPLAN_NAME"
Use the following query to view consumption details for a Compute Engine resource.
logName:"bdr_backup_vault_details" jsonPayload.sourceResourceName:"instances/SOURCE_RESOURCE_NAME"
What's next
- To configure log-based alerts for Backup and DR Service, create a log query, using the filter job logs, and then Configure log-based alerts.