Viewing error logs in Cloud Logging

This page explains how to view logs in Google Cloud Observability for supported request types.

Logging

Errors triggered in each of the following requests are logged to Cloud Logging.

Errors are also logged if a Pub/Sub message can't be published to Pub/Sub. See Troubleshooting Pub/Sub notifications for more information.

Logging is automatic and doesn't need to be enabled. To disable Cloud Logging for one or all monitored resources, see Logs exclusions.

Viewing logs

To view all logs, go to the Logs Explorer.

To view logs for operations with an error status, follow these steps:

  1. In the Google Cloud console, go to the Cloud Healthcare API browser.

    Go to the Cloud Healthcare API browser

  2. Select a dataset.

  3. Click the Operations tab.

  4. In the list of operations, choose View details in Cloud Logging from the Actions list to view the details of an erroneous operation.

Filtering logs

You can filter logs by data store type, region, and dataset.

For example, to view logs for FHIR stores, click Healthcare FHIR Store in the first list under Filter by label or text search. You can also search by resource type. For example, searching for healthcare_dicom_store displays all logs generated for operations with resource.type set to healthcare_dicom_store.

UTF-8 encoding is enforced for log fields. Characters that aren't UTF-8 characters are replaced with question marks.

For detailed information about the Logs Explorer, see Using the Logs Explorer.

Using Cloud Logging to find error events

You can also use Cloud Logging to find the audit log of an event causing an error. To find a error event in the audit logs, do the following:

  1. Search Cloud Logging for the operation that caused.

  2. Using the operation's log details, re-run the specific command.

  3. View the audit logs for the corresponding event. For more information on audit logs, see Viewing Cloud Audit Logs.

What is logged

Cloud Healthcare API log entries contain the following types of information for debugging requests:

  • General information, such as severity, project ID, project number, and timestamp.
  • jsonPayload contains the actual body of the entry. This field contains the error code, the error message, and the name of the source file whose import triggered the error.
  • operation contains the type and ID of the operation that produced the error.
  • resource contains the location, dataset, and data store involved in the error.

If the number of errors exceeds a threshold, a limited number of errors appears in Cloud Logging. The threshold is dynamically calculated based on the size of the input.

Where logs are stored

Google Cloud Observability isn't a regionalized product. Logs written to Google Cloud Observability could be stored in a different region from the data stores.

Sample DICOM import log entry

The following sample log entry shows an empty DICOM instance found error that occurred while attempting to import gs://DICOM_FILENAME.dcm to projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/dicomStores/DICOM_STORE_ID.

 jsonPayload: {
  @type:  "type.googleapis.com/google.cloud.healthcare.logging.ImportDicomLogEntry"
  error: {
   code:  3
   message:  "empty DICOM instance found"
  }
  source:  "gs://DICOM_FILENAME.dcm"
 }
 logName:  "projects/PROJECT_ID/logs/healthcare.googleapis.com%2Foperations"
 operation: {
  id:  "PROJECT_ID"
  producer:  "import_dicom"
 }
 receiveTimestamp:  "TIMESTAMP"
 resource: {
  labels: {
   dataset_id:  "DATASET_ID"
   dicom_store_id:  "DICOM_STORE_ID"
   location:  "LOCATION"
   project_id:  "PROJECT_ID"
  }
  type:  "healthcare_dicom_store"
 }
 severity:  "ERROR"
 timestamp:  "TIMESTAMP"

Sample FHIR import log entry

The following sample log entry shows a cannot import resource error that occurred while attempting to import gs://FHIR_FILENAME.ndjson to projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/fhirStore/FHIR_STORE_ID.

 jsonPayload: {
  @type:  "type.googleapis.com/google.cloud.healthcare.logging.ImportFhirLogEntry"
  error: {
   code:  3
   message:  "cannot import resource Patient/PATIENT_ID, conflicting resource already exists"
  }
  source:  "gs://FHIR_FILENAME.ndjson"
 }
 logName:  "projects/PROJECT_ID/logs/healthcare.googleapis.com%2Foperations"
 operation: {
  id:  "PROJECT_ID"
  producer:  "import_fhir"
 }
 receiveTimestamp:  "TIMESTAMP"
 resource: {
  labels: {
   dataset_id:  "DATASET_ID"
   fhir_store_id:  "FHIR_STORE_ID"
   location:  "LOCATION"
   project_id:  "PROJECT_ID"
  }
  type:  "healthcare_fhir_store"
 }
 severity:  "ERROR"
 timestamp:  "TIMESTAMP"

Sample annotation import log entry

The following sample log entry shows a failed to parse Cloud Storage object error that occurred while attempting to import gs://ANNOTATION_FILE.json to projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/annotationStores/ANNOTATION_STORE_ID.

jsonPayload: {
  @type:
  "type.googleapis.com/google.cloud.healthcare.logging.ImportAnnotationLogEntry"
  error: {
    code:  3
    message:  "failed to parse Cloud Storage object"
  }
  source:  "gs://ANNOTATION_FILE.json"
}
logName:
"projects/PROJECT_ID/logs/healthcare.googleapis.com%2Fimport_annotations"
operation: {
  id:
  "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID"
  producer:  "healthcare.googleapis.com/ImportAnnotations"
}
receiveTimestamp:  "TIMESTAMP"
resource: {
  labels: {
    annotation_store_id:  "ANNOTATION_STORE_ID"
    dataset_id:  "DATASET_ID"
    location:  "LOCATION"
    project_id:  "PROJECT_ID"
  }
  type:  "healthcare_annotation_store"
}
severity:  "ERROR"
timestamp:  "TIMESTAMP"

Sample DICOM de-identify log entry

The following sample log entry shows a cannot de-identify dicom instance error that occurred while trying to de-identify DICOM instance INSTANCE_ID in dataset projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID.

 jsonPayload: {
  @type:  "type.googleapis.com/google.cloud.healthcare.logging.DeidentifyLogEntry"
  error: {
   code:  2
   message:  "Failed to process instance INSTANCE_ID"
  }
  resourceName:  "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID"
 }
 logName:  "projects/PROJECT_ID/logs/healthcare.googleapis.com%2Fdeidentify_dataset"
 operation: {
  id:  "projects/PROJECT_ID/locations/LOCATION/datasets/DATASET_ID/operations/OPERATION_ID"
  producer:  "healthcare.googleapis.com/DeidentifyDataset"
 }
 receiveTimestamp:  "TIMESTAMP"
 resource: {
  labels: {
   dataset_id:  "DATASET_ID"
   location:  "LOCATION"
   project_id:  "PROJECT_ID"
  }
  type:  "healthcare_dataset"
 }
 severity:  "ERROR"
 timestamp:  "TIMESTAMP"

What's next