Backup and restore job logs for vaulted backups

This page explains how to view the backup and restore job logs for vaulted backups in Cloud Logging. These backups are for the resources protected using backup plans. If you want to view the backup and restore job logs that are protected using the backup template in the management console, see Backup and recovery job logs.

Permissions and roles

You need the IAM permission roles/logging.viewer to view the backup and restore job logs. The Logs Viewer role gives you read-only access to view backup and restore job logs of all resources protected by backup plan in the specified project. If backup and restore operations are performed in a different project, ask your administrator to assign the permission roles/logging.viewer in the project where you want to view logs. For more information about the IAM permissions and roles to control access to logs data, see Access control with IAM.

View backup and restore job logs

You can view backup and restore job logs for vaulted backups in Cloud Logging by using the Google Cloud console and the Google Cloud CLI. To view backup jobs, select either the backup vault project or the resource project where the backup is performed. To view restore jobs, select either the backup vault project or the project in which the resource is restored.

Console

In the Google Cloud console, you can use the Logs Explorer to retrieve the backup and restore logs entries for your vaulted backups:

  1. In the Google Cloud console, go to the Logging > Logs Explorer.
  2. Select an existing Cloud project.
  3. In the Query builder pane, select bdr_backup_restore_jobs 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 and restore log entries of a project, run the following command:

 gcloud logging read "logName:bdr_backup_restore_jobs" --project=PROJECT_ID

Replace the following:

  • PROJECT_ID: the name of the project. To view backup jobs, you can enter either the backup vault project or the resource project where the backup is performed. To view restore jobs, you can enter either the backup vault project or the project in which the resource is restored.

Backup and restore jobs log format

Backup and restore log entries include the following fields:

Field Description
jobId The ID associated with the job.
sourceResourceName The relative name of the protected resource.
jobCategory The category of job, which can be SCHEDULED_BACKUP, ON_DEMAND_BACKUP, or RESTORE.
sourceResourceId The ID of the protected resource.
resourceType The type of resource. For example, a Compute Engine instance.
jobStatus The status of the job, which can be SUCCESSFUL, FAILED, RUNNING, SKIPPED.
backupRule The name of the backup rule that triggered the backup job.
backupVaultName The relative name of the backup vault where the backups are stored.
startTime The start time of the job, which is in the YYYY-MM-DD HH:MM:SS.SSS UTC format.
backupPlanName The relative name of the backup plan that is associated with the resource. For restore jobs, the backup plan name field remains Null.
errorCode The error code associated for the failed job. The error code is displayed as Null if no error occurred for the job.
errorType The name of the error type. For example, PERMISSION_DENIED. The error type is displayed as Null if no error occurred for the job.
errorMessage The error message for the failed job. The error message is displayed as Null if no error occurred for the job.
restoreResourceName The relative name of the resource that gets created after the successful restoration.
backupName For backup jobs, the backup name is a system generated name for the backup in the form of UUID. For restore jobs, the backup name is the name of the backup used to perform the restore.

The following sample is an example of a log entry for a scheduled backup on a Compute Engine instance.

        {
        "insertId": "696883be-582d-4af4-b2b8-a4c497e49489",
        "jsonPayload": {
          "jobId": "696883be-582d-4af4-b2b8-a4c497e49489",
          "@type": "type.googleapis.com/google.cloud.backupdr.logging.v1.BDRBackupRestoreJobLog",
          "sourceResourceName": "projects/Source_project_ID/zones/asia-east1-c/instances/Instance_name",
          "jobCategory": "SCHEDULED_BACKUP",
          "sourceResourceId": "6114243930178522357",
          "resourceType": "Compute Engine",
          "jobStatus": "RUNNING",
          "backupRule": "backup-rule-1",
          "backupVaultName": "projects/Backupvault_project_ID/locations/asia-east1/backupVaults/Backupvault_name",
          "startTime": "2024-09-10T06:37:00.303416182Z",
          "backupPlanName": "projects/Backupplan_project_ID/locations/asia-east1/backupPlans/Backupplan_Name"
        },
        "resource": {
          "type": "backupdr.googleapis.com/BackupDRProject",
          "labels": {
            "resource_container": "projects/223618678509",
            "location": "asia-east1"
          }
        },
        "timestamp": "2024-09-10T06:37:00.303416182Z",
        "logName": "projects/Backupvault_Name/logs/backupdr.googleapis.com%2Fbdr_backup_restore_jobs",
        "receiveTimestamp": "2024-09-10T06:37:01.818767274Z"
      }

Sample queries

To view selected logs, you can write custom queries in the query section.

Use the following query to view failed jobs.

    logName:"bdr_backup_restore_jobs" jsonPayload.jobStatus="FAILED"

Use the following query to view jobs stored in a backup vault.

    logName:"bdr_backup_restore_jobs" jsonPayload.backupVaultName:"backupVaults/BACKUPVAULT_NAME"

Use the following query to view jobs created with a backup plan.

    logName:"bdr_backup_restore_jobs" jsonPayload.backupPlanName:"backupPlans/BACKUPPLAN_NAME"

What's next