Collect error data by using Error Reporting

This document lists the environments supported by Error Reporting and it links to language-specific guides for application developers. We recommend that you use the language-specific client libraries or rely on automatically-collected logs; however, you can write error data with the Cloud Logging API or the Error Reporting API. For example, if you use Cloud Run, then exceptions written to stderr are automatically sent to Cloud Logging.

Error Reporting is a global service that automatically analyzes the logs in your Google Cloud project to identify errors. However, Error Reporting can only analyze log entries that are stored in Cloud Logging buckets that are in the global region, where the source and destination Google Cloud projects are the same, and where customer-managed encryption keys (CMEK) are disabled. If you route logs to a different Google Cloud project, regionalized buckets, or enable CMEK, then Error Reporting doesn't capture and analyze those logs. For information about how to verify the configuration of your log buckets, see Troubleshooting.

Virtual Private Cloud support

Error Reporting is a Virtual Private Cloud (VPC) supported service.

To reduce the risk of data exfiltration, use VPC Service Controls to create a service perimeter around your Google-managed services. For information about VPC Service Controls and how to create a service parameter, see the VPC Service Controls documentation.

Configure environments to automatically report error data

For information about environment-specific configuration requirements, see the following guides:

Instrument apps by using client libraries

For information about how to configure your application to send error reports, see the language-specific configuration guides:

Write error data by using an API

You can report error events to your Google Cloud project by executing the Error Reporting API method report or the Cloud Logging API method write.

  • If you require API key-based authentication, then you must use the Error Reporting API. To report an error event by using the Error Reporting API, execute the method report and format the request body of the method as a ReportedErrorEvent object.

    When you use the Error Reporting API, log entries with properly formatted error messages are automatically generated and written to Cloud Logging. These log entries are written to a log whose logName is formatted as follows:


    Because log entries are generated by calls to report, you might incur Cloud Logging ingestion costs. To control which logs are ingested, see Exclusion filters.

    If you report error events by using the Error Reporting API, the remainder of this document doesn't apply.

  • If you want to use the Cloud Logging API, then you must format the LogEntry object so that includes a stack trace, or a ReportedErrorEvent object. For more information about the formatting requirements, see Format errors in logs.