您请求访问的页面目前没有您的语言版本。您可以从页面底部选择其他语言,或使用 Google Chrome 的内置翻译功能将网页内容即时翻译成您选择的语言。

Link Cloud Logging to Firebase

Linking your Firebase project to Cloud Logging allows you to view, search, and filter logs from your project.

  • Firebase Hosting: After you link your project, it exports web request logs from your Firebase Hosting sites to Cloud Logging.
  • Cloud Functions for Firebase: You don't need to configure or link your project for it to automatically export function logs to Cloud Logging.

In this article:

About exports to Cloud Logging

Cloud Logging is provided by Google Cloud's operations suite.

When you export your logs to Cloud Logging, you can use the Logs Viewer interface in the Google Cloud console to view, search, and filter these logs. You can use other Google Cloud tools to query your logs, create and use log-based metrics, and store your logs data. Learn more about these tools in the Cloud Logging documentation.

For Cloud Functions, you can also view your logs in the Functions dashboard of the Firebase console.

Firebase Hosting

By using Cloud Logging with Hosting, you can track from where and when you have visits to your site, your site's response statuses, the latency of end user requests, and more.

If you have multiple Hosting sites in your project, you can select which of your Hosting sites will export logs. You can then filter and view your logs data by Hosting site and even by domain. By selecting specific Hosting sites to export logs, you can also control the amount of data processed for your project. To view the data usage for logs from your Hosting sites, visit the Cloud Logging integration card in the Firebase console.

Learn more about the Cloud Logging integration with Firebase Hosting in the Hosting documentation.

Cloud Logging quotas, pricing, and retention

Cloud Logging is free for up to 50GB of data usage per month (per project). This usage can be from any Google or Firebase product using Cloud Logging. You can upgrade your project to the Blaze billing plan to unlock additional paid usage. Learn more about pricing for Cloud Logging.

You can monitor and manage Cloud Logging and billing:

Logs from both Firebase Hosting and Cloud Functions for Firebase are automatically deleted after 30 days, with the option to set custom retention.

Note that the log entry for a particular request may be delayed or, in rare cases, dropped. While logs can be used to understand requests, they may not reflect the true usage that appears in your project usage and billing.

Here's how to link your Firebase project, specifically your Firebase Hosting sites, to Cloud Logging:

  1. Go to your the Settings icon Project settings in the Firebase console.
  2. Select the Integrations tab.
  3. On the Cloud Logging card, click Link.
  4. Follow the on-screen instructions to select which Hosting sites will export logs.
    If you already have one or more active Hosting sites, the linking workflow displays an estimated data usage level for logs from each of your Hosting sites. This value is estimated from the past 30 days.

After linking, logs for any new requests to your Hosting sites will usually show up within 30 minutes of a request being made.

You can view the data usage level for logs from your Hosting sites in the Cloud Logging integration card in the Firebase console. You can also view your per-site data usage level in the Logs Viewer interface in the Google Cloud console (the log_bytes metric). If your project uses Cloud Logging for other products, you can also view total usage in the Logs Viewer interface.

By unlinking your Firebase project from Cloud Logging, you stop all Firebase Hosting exports to Cloud Logging.

NOTE: Instead of completely unlinking Hosting from Cloud Logging, you can select to stop sending logs from specific Hosting sites via the Cloud Logging integration card in the Firebase console.

Be aware of the following:

  • If you use Cloud Functions for Firebase, then your function logs will continue to be exported to Cloud Logging.
  • If you don't delete your datasets for Hosting logs in Cloud Logging, they will persist for 30 days, then be deleted from Cloud Logging automatically.
  • If you have Cloud Logging data for Hosting logs stored in other services (like BigQuery), that data might be governed by different terms for data persistence.

Here's how to unlink your Firebase project, specifically your Firebase Hosting sites, from Cloud Logging:

  1. Go to your the Settings icon Project settings in the Firebase console.
  2. Select the Integrations tab.
  3. On the Cloud Logging card, click Manage.
  4. At the bottom of the page, click Stop exports to Cloud Logging.
  5. Confirm that you want to unlink and stop all exports.

该内容对您有帮助吗?

您有什么改进建议?
Search
Clear search
Close search
Google apps
Main menu
8933896968260511678
true
搜索支持中心
true
true
true