Query error logs for Google Chat apps (original) (raw)

This guide describes how to query Chat app error logs in Google Cloud Logs Explorer. Query logs to:

Prerequisites

  1. In the Google API Console, click Menu > More products > Logging > Logs Explorer.
    Go to Log Explorer
  2. If necessary, to show the query builder, turn on Show query.
  3. For Chat app error logs, enter the following query:
severity=ERROR  
resource.type="chat.googleapis.com/Project"  
  1. To see recent errors, click Run query. Or, to see errors as they occur, click Stream logs. Chat app error logs appear in the "Query results" pane.

To learn more about Google Cloud Logs Explorer and writing queries, see these guides in the Logs Explorer documentation:

Read an error message from a log

After querying an error log, you can view individual logs which consist of a JSON payload describing the log. For Chat app errors, the JSON includes the error message at jsonPayload.error.message. For example, in the following sample log, the error message says that an Apps Script function failed to execute:

JSON

{
  "insertId": "INSERT_ID",
  "jsonPayload": {
    "@type": "type.googleapis.com/google.chat.logging.v1.ChatAppLogEntry",
    "error": {
      "code": 9,
      "message": "An Apps Script function failed to execute. To review AppsScript error logs, see \"Logging\" (https://developers.google.com/apps-script/guides/logging)."
    },
    "deployment": "DEPLOYMENT_ID"
  },
  "resource": {
    "type": "chat.googleapis.com/Project",
    "labels": {
      "project_id": "PROJECT_ID"
    }
  },
  "timestamp": "2022-12-06T05:24:18.697255Z",
  "severity": "ERROR",
  "logName": "projects/PROJECT_ID/logs/chat.googleapis.com%2Ferrors",
  "receiveTimestamp": "2022-12-06T05:24:19.207936968Z"
}

Considerations

As you work with Chat app error logs in Google Cloud Logs Explorer, take note of these considerations:

After querying error logs, if you find errors, see the following guides for help fixing errors: