ROAR DocumentationROAR Documentation
  • Databases
  • Workflows
  • Application
  • GitHub Actions
  • Dashboard Components
  • Firebase App Check
  • Cloud Functions
  • Backend Architecture
  • Internationalization
  • Integrating New Apps
  • Optimizing Assets
  • ROAR Redivis Instance
  • Logging and Querying
  • Emulation
  • Data Guidelines
  • Data Organization
  • Data Requests
GitHub
  • Databases
  • Workflows
  • Application
  • GitHub Actions
  • Dashboard Components
  • Firebase App Check
  • Cloud Functions
  • Backend Architecture
  • Internationalization
  • Integrating New Apps
  • Optimizing Assets
  • ROAR Redivis Instance
  • Logging and Querying
  • Emulation
  • Data Guidelines
  • Data Organization
  • Data Requests
GitHub
  • Databases
    • Database Information
    • gse-roar-admin
    • gse-roar-assessment
  • BigQuery
    • Querying Assessment Data
    • BigQuery schema: classes
    • BigQuery schema: districts
    • BigQuery schema: families
    • BigQuery schema: groups
    • BigQuery schema: schools
    • BigQuery schema: user_runs
    • BigQuery schema: user_trials
    • BigQuery schema: users
  • Workflows
    • Workflows
    • Creating an Assignment
    • Authentication
    • Creating new Users
    • User Roster Changes
    • How to Impersonate a Clever User on Localhost
  • Application

    • Auth
  • GitHub Actions
    • ROAR Apps GitHub Actions
      • GitHub Actions in ROAR Apps
      • firebase-deploy-preview.yml
      • firebase-hosting-merge.yml
      • publish-to-npm-create-new-release.yml
      • submit-dashboard-pr.yml
    • ROAR Dashboard GitHub Actions
      • GitHub Actions in the ROAR Dashboard
  • Dashboard Components
    • Dashboard Components
    • Organization Score Reports
  • Firebase App Check
    • Firebase App Check Configuration for roar-firekit and roar-dashboard
  • Backend Architecture
    • Architecture
      • Backend Architecture in ROAR
      • Data Models
      • Database Implementations
      • Error Handling Architecture in ROAR
      • Repository Layer Architecture
      • Service Layer Architecture
    • API
      • Classes
        • Class: AdministrationServiceError
        • Class: FirebaseClientError
        • Class: FirebaseImplementationError
        • Class: FirestoreAdministrationRepository
        • Class: FirestoreAdministrationRepositoryError
        • Class: abstract FirestoreBaseRepository<T>
        • Class: FirestoreFilterAdapter
        • Class: FirestoreIdentityProviderRepository
        • Class: FirestoreIdentityProviderRepositoryError
        • Class: FirestoreOrgRepository
        • Class: FirestoreOrgRepositoryError
        • Class: FirestoreRepositoryError
        • Class: FirestoreUserClaimRepository
        • Class: FirestoreUserClaimRepositoryError
        • Class: FirestoreUserRepository
        • Class: FirestoreUserRepositoryError
        • Class: IdentityProviderServiceError
        • Classes
      • Enumerations
        • Enumeration: CollectionType
        • Enumeration: IdentityProviderType
        • Enumeration: Operator
        • Enumerations
      • Functions
        • Functions
        • Function: chunkOrgs()
        • Function: createAdministrationService()
        • Function: createFirestoreImplementation()
        • Function: createIdentityProviderService()
        • Function: isEmptyOrgs()
      • Interfaces
        • Interface: Administration
        • Interface: AdministrationBaseRepository
        • Interface: AdministrationService
        • Interface: AssentConsent
        • Interface: Assessment
        • Interface: BaseModel
        • Interface: BaseRepository<T>
        • Interface: Claims
        • Interface: CompositeCondition
        • Interface: CompositeFilter
        • Interface: CreateAdministrationServiceParams<AdminRepo, OrgRepo, UserClaimRepo>
        • Interface: CreateParams
        • Interface: DeleteParams
        • Interface: EducationalOrgsList
        • Interface: FieldCondition
        • Interface: FilterAdapter<T>
        • Interface: FirestoreCreateParams
        • Interface: FirestoreDeleteParams
        • Interface: FirestoreFetchDocumentParams
        • Interface: FirestoreGetAllParams
        • Interface: FirestoreGetByIdParams
        • Interface: FirestoreGetByNameParams
        • Interface: FirestoreGetByRoarUidParams
        • Interface: FirestoreGetParams
        • Interface: FirestoreGetWithFiltersParams
        • Interface: FirestoreImplementation
        • Interface: FirestoreRunTransactionParams<T>
        • Interface: FirestoreUpdateParams
        • Interface: FutureParams
        • Interface: GetAdministrationIdsForAdministratorParams
        • Interface: GetAdministrationIdsFromOrgsParams
        • Interface: GetAllParams
        • Interface: GetByNameParams
        • Interface: GetByProviderIdParams
        • Interface: GetByRoarUidParams
        • Interface: GetParams
        • Interface: GetRoarUidParams
        • Interface: IdentityProvider
        • Interface: IdentityProviderBaseRepository
        • Interface: IdentityProviderService
        • Interface: Legal
        • Interface: OrgBase
        • Interface: OrgBaseRepository
        • Interface: OrgsList
        • Interfaces
        • Interface: Result<T>
        • Interface: RunTransactionParams<T>
        • Interface: SingleFilter
        • Interface: UpdateParams
        • Interface: User
        • Interface: UserBaseRepository
        • Interface: UserClaim
        • Interface: UserClaimBaseRepository
        • Interface: createIdentityProviderServiceParams<IDPRepo, UserClaimRepo, UserRepo>
        • Interface: getAdministrationIdsFromOrgsParams
        • Interface: _setAdministrationIdsParams
      • Type Aliases
        • Type Alias: BaseFilter
        • Type Alias: ComparisonOperator
        • Type Alias: Condition
        • Type Alias: DocumentCreatedEvent
        • Type Alias: DocumentDeletedEvent
        • Type Alias: DocumentUpdatedEvent
        • Type Alias: DocumentWrittenEvent
        • Type Alias: ParameterValue
        • Type Aliases
        • Type Alias: SelectAllCondition
      • Variables
        • Variable: FirebaseAppClient
        • Variable: FirebaseAuthClient
        • Variable: FirestoreClient
        • Variable: ORG_NAMES
        • Variables API Documentation
    • Examples
      • Examples
    • Guides
      • Guides
  • Cloud Functions
    • gse-roar-admin
      • Admin Database
      • appendToAdminClaims()
      • associateassessmentuid()
      • createAdministratorAccount()
      • createGuestDocsForGoogleUsers()
      • createLevanteGroup()
      • createLevanteUsers()
      • createnewfamily()
      • createstudentaccount()
      • mirrorClasses()
      • mirrorCustomClaims
      • mirrorDistricts()
      • mirrorFamilies()
      • mirrorGroups()
      • mirrorSchools()
      • removefromadminclaims()
      • saveSurveyResponses()
      • setuidcustomclaims()
      • softDeleteUserAssignment()
      • softDeleteUserExternalData
      • softDeleteUser()
      • syncAssignmentCreated()
      • syncAssignmentDeleted()
      • syncAssignmentUpdated()
      • syncAssignmentsOnAdministrationUpdate()
      • syncAssignmentsOnUserUpdate()
      • syncCleverOrgs()
      • syncCleverUser()
    • gse-roar-assessment
      • Assessment Database
      • organizeBucketLogsByDate()
      • setuidclaims()
      • softDeleteGuestTrial()
      • softDeleteGuest()
      • softDeleteUserRun()
      • softDeleteUserTrial()
      • syncOnRunDocUpdate()
  • Internationalization
    • ROAM Fluency
    • ROAR Letter
    • ROAR Phoneme
    • Internationalization of ROAR Apps
    • ROAR Sentence
    • ROAR Word
  • Integrating New Apps
    • Integrating Roar Apps into the Dashboard
    • Dashboard Integration
    • Monitoring and Testing
    • Preparing the App for Packaging and Deployment
    • Packaging and Publishing to npm
    • Secrets in the GitHub Repository
  • Assets Optimization
    • Optimizing Assets
    • Audio Optimization Guide
    • Image Optimization Guide
  • ROAR Redivis Instance
    • ROAR Redivis Instance
    • ROAR Data Validator Trigger
    • ROAR Data Validator
  • Logging and Querying
    • ROAR Logging
  • Emulation
    • Running the Emulator
      • Commands
    • Emulator Configuration Guide
      • Configuration
      • Cypress Configuration
      • Setup and Dependencies
      • Firebase CLI Configuration
      • Firebase Emulator Configuration
      • GitHub Secrets and Workflows
      • Importing and Exporting Data
      • Local Environment Variables
  • Clowder Implementation
    • Clowder Integration
    • Letter - Clowder
    • Multichoice - Clowder
    • Phoneme - Clowder
    • ARF & CALF - Clowder

ROAR Logging

Much of the infrastructure that supports ROAR operates on the Google Cloud Platform (GCP), including Firestore, Cloud Functions, and Cloud Scheduler. To monitor and debug these services, we leverage Google Cloud Console, which offers a comprehensive suite of tools for logging and observability.

Google Cloud Logging is a fully managed service that collects and stores logs from various Google Cloud services. It allows you to search, analyze, monitor, and set up alerts based on log data from both Google Cloud Platform (GCP) and Amazon Web Services (AWS). Logs are centralized, making it easy to search and filter entries from different services.

You can access the Google Cloud Platform web console here.

The console supports structured querying of logs, which is useful for debugging and monitoring services. Logs can be filtered by severity level, resource type, and time range, and they can be exported to Google Cloud Storage, BigQuery, or Pub/Sub for further analysis. Logs can also be saved as local .csv and .json files.

For more information on Google Cloud Logging query language, refer to the documentation.

Cloud Audit Logging

ROAR has enabled Cloud Audit Logs, which provide a record of actions taken by users, service accounts, or APIs that modify resources. These logs are crucial for monitoring and troubleshooting activities within the Google Cloud Platform.

ROAR currently monitors admin activity, data access, policy denials, and system events for Firebase. These logs are stored in the Cloud Logging service and can be accessed through the Google Cloud Console.

For more information on Cloud Audit Logging, refer to the documentation.

Logging Query Language

The Google Cloud Logging Query Language allows for structured queries on logs. Similar to SQL, it enables filtering and aggregation of logs based on various criteria such as severity level, resource type, and time range. The query language can also be used to create metrics based on log data.

You can construct queries using either the Google Cloud Console or the Google Cloud CLI.

Firebase Cloud Audit Logs provide a list of method events logged by Firebase during the execution of a transaction. The complete list of methods logged by Firebase is available here.

For a deeper understanding of audit logs, including their structure, refer to this guide.

Sample Queries Using gcloud CLI

Here’s the general structure of the gcloud logging read command for querying Firestore methods in your project (replace METHOD_NAME and LIMIT with the appropriate values):

gcloud logging read 'resource.type="audited_resource" AND logName="projects/gse-roar-admin/logs/cloudaudit.googleapis.com%2Fdata_access" AND protoPayload.methodName="METHOD_NAME"' --project=gse-roar-admin --limit=LIMIT
  • resource.type="audited_resource": Specifies that the resource type being audited is audited_resource.
  • logName="projects/gse-roar-admin/logs/cloudaudit.googleapis.com%2Fdata_access": Filters the log entries to include only Data Access logs for the specified project.
  • protoPayload.methodName="METHOD_NAME": Filters the logs to include only the specified Firestore method.
  • --limit=LIMIT: Limits the number of log entries returned. Replace LIMIT with the desired number.

Query for google.firestore.v1.Firestore.GetDocument

gcloud logging read 'resource.type="audited_resource" AND logName="projects/gse-roar-admin/logs/cloudaudit.googleapis.com%2Fdata_access" AND protoPayload.methodName="google.firestore.v1.Firestore.GetDocument"' --project=gse-roar-admin --limit=50

Query for google.firestore.v1.Firestore.CreateDocument

gcloud logging read 'resource.type="audited_resource" AND logName="projects/gse-roar-admin/logs/cloudaudit.googleapis.com%2Fdata_access" AND protoPayload.methodName="google.firestore.v1.Firestore.CreateDocument"' --project=gse-roar-admin --limit=50

Query for google.firestore.v1.Firestore.DeleteDocument

gcloud logging read 'resource.type="audited_resource" AND logName="projects/gse-roar-admin/logs/cloudaudit.googleapis.com%2Fdata_access" AND protoPayload.methodName="google.firestore.v1.Firestore.DeleteDocument"' --project=gse-roar-admin --limit=50

Adjusting Time Range (Optional)

To filter logs within a specific time range, add a timestamp filter to the query, as shown in previous examples.

protoPayload Object

In Google Cloud Logging, the protoPayload field contains structured data about the log entry, including details about the request, the response, and the authentication context. Understanding protoPayload is essential for effectively querying and analyzing logs. Below are descriptions and examples of commonly used protoPayload fields:

protoPayload.request

The protoPayload.request field contains the request parameters sent by the client, which is useful for understanding the specific details of the operation performed.

  • protoPayload.request.name: The name of the resource being accessed.

    gcloud logging read 'resource.type="audited_resource" AND logName="projects/gse-roar-admin/logs/cloudaudit.googleapis.com%2Fdata_access" AND protoPayload.request.name="projects/gse-roar-admin/databases/(default)/documents/users/VqjBqFBh4XOt9E0HdKVbTqfV1aq2"' --limit=50
    
  • protoPayload.request.writes.delete: The delete field in the writes object indicates that a document was deleted.

    gcloud logging read 'resource.type="audited_resource" AND logName="projects/gse-roar-admin/logs/cloudaudit.googleapis.com%2Fdata_access" AND protoPayload.request.writes.delete:*' --project=gse-roar-admin
    

protoPayload.response

The protoPayload.response field contains the response returned by the server, including the result of the operation. This field is useful for debugging or verifying the outcomes of specific requests.

gcloud logging read 'resource.type="audited_resource" AND protoPayload.response.fields.field_name.stringValue="desired_value"' --limit=50

protoPayload.methodName

The protoPayload.methodName field specifies the method that was invoked. This field identifies the type of operation, such as google.firestore.v1.Firestore.GetDocument.

  • google.firestore.v1.Firestore.GetDocument: Retrieves calls to fetch a document from Firestore.

    gcloud logging read 'resource.type="audited_resource" AND protoPayload.methodName="google.firestore.v1.Firestore.GetDocument"' --limit=50
    
Edit this page
Last Updated:
Contributors: Elijah Kelly, Kyle
Prev
ROAR Redivis Instance
Next
Emulation