Skip to main content

How to get Firebase logs into Google Cloud Platform

This guide will walk you through how to ensure a Firebase project’s logs show up in Google Cloud Logging.

Written by Alan Butcher

Before you start

The Google Cloud Platform (GCP) integration needs to be set up first. If you haven’t done this yet, follow How to integrate Google Cloud Platform, then return to this guide to add your Firebase logs.

How it works

A Firebase project is also a Google Cloud project, so its logs are written to Cloud Logging automatically. Admin Activity audit logs are always on. The security-relevant logs (reads, writes, sign-ins) are off by default, so the main job is switching them on.

Step 1: Open the project in Google Cloud

  1. In the Firebase console, go to Project settings and copy the Project ID.

  2. Open the Google Cloud console and select that project from the project picker at the top.

Step 2: Turn on Data Access audit logs

  1. Go to IAM and Admin → Audit logs.

  2. Find each service you use and tick it:

    • Firebase App Check API

    • Identity Toolkit API (Firebase Authentication)

    • Firebase Management API

    • Firebase Realtime Database API

    • Cloud Storage for Firebase API

    • Firebase Security Rules API

  3. In the panel on the right, tick Data Read and Data Write, then click Save.

Tip: enable only the services you actually use. Data Access logs can be very high volume and increase Cloud Logging costs. Not every API offers all log types, so only the options shown for that API are available.

Step 3: Capture sign-in activity (Authentication)

Firebase Authentication only logs sign-in events if the project uses Identity Platform.

  1. In the Firebase console, go to Authentication and choose Upgrade to Identity Platform if prompted.

  2. In the Google Cloud console, open Identity Platform → Settings and turn on Logging.

Step 4: Check that the logs are arriving

  1. Go to Logging → Logs Explorer.

  2. Run this query: logName:"cloudaudit.googleapis.com" protoPayload.serviceName=("firebaseappcheck.googleapis.com" OR "identitytoolkit.googleapis.com" OR "firebase.googleapis.com" OR "firebasedatabase.googleapis.com" OR "firebasestorage.googleapis.com" OR "firebaserules.googleapis.com")

  3. Use the app (read or write some data, or sign in) and refresh. Entries should appear within a minute or two.

Step 5: Add the filters and send logs to the SIEM

If you already export logs with a sink to Pub/Sub, check the sink’s filter so the Firebase logs aren’t left out.

  1. Go to Logging → Log Router and edit your SIEM sink.

  2. Check the scope. A project-level sink must live in the Firebase project. An org or folder sink needs Include logs from child resources ticked.

  3. Look at the Inclusion filter. If it is empty, everything is exported, and there is nothing to add. If it is narrower, add this Firebase filter: logName:"cloudaudit.googleapis.com" protoPayload.serviceName=("firebaseappcheck.googleapis.com" OR "identitytoolkit.googleapis.com" OR "firebase.googleapis.com" OR "firebasedatabase.googleapis.com" OR "firebasestorage.googleapis.com" OR "firebaserules.googleapis.com")

  4. If the sink already has a filter, join the two with OR and wrap each part in brackets so you don’t narrow what you already collect: (<your existing filter>) OR (<the Firebase filter above>)

    Optional: to include file-level Cloud Storage events (uploads, downloads, deletions), add this as another OR part. These are logged under storage.googleapis.com, not the Firebase service name, so the clause is limited to the Firebase bucket. Use the real bucket name from the Firebase console (.firebasestorage.app for newer projects, .appspot.com for older ones), and make sure Data Access logging is enabled for Cloud Storage: (protoPayload.serviceName="storage.googleapis.com" AND resource.labels.bucket_name=("PROJECT_ID.firebasestorage.app" OR "PROJECT_ID.appspot.com"))

  5. Optional: to include Cloud Functions logs from the same project, add this as another OR part: resource.type=("cloud_function" OR "cloud_run_revision")

  6. Optional: if volume or cost is too high, add an Exclusion filter on the sink for the noisiest service, for example: logName:"cloudaudit.googleapis.com%2Fdata_access" AND protoPayload.serviceName="firebasedatabase.googleapis.com"

    This stops Realtime Database Data Access logs being exported, so only use it if you accept that gap.

  7. Click Update sink. Make sure the sink’s writer identity has Pub/Sub Publisher on the topic, otherwise nothing is delivered.

Troubleshooting

Problem

Likely cause

No Data Access entries

The service isn’t ticked in Audit logs, or nothing has read or written data yet

No sign-in events

The project isn’t on Identity Platform, or its logging is off

No file upload or download events

Cloud Storage Data Access logs aren’t enabled, or the storage.googleapis.com clause from Step 5 hasn’t been added

Logs in Logs Explorer but not in the SIEM

The sink filter or scope is wrong, or the writer identity lacks Pub/Sub Publisher

And that's it! You've successfully integrated Google Firebase with Google Cloud Platform 🎉

Did this answer your question?