How to get audit logs from GCP in my app ?

I am developing an app where I want whatever audit logs are related to a certain ML workflow , I get them in my app .

Which google api do I need to call ? 

How to do the Google authentication before making audit log api requests to Google?

My app uses ReactJS + NodeJS .

4 1 86
1 REPLY 1

To retrieve audit logs related to a certain ML workflow on Google Cloud Platform (GCP), you can use the Google Cloud Audit Logs API. This API provides access to log entries that are generated by GCP services. Specifically, you'll want to use the entries.list method to retrieve audit logs.

Here's how you can authenticate and make requests to the Google Cloud Audit Logs API using Node.js in your ReactJS + NodeJS application:

  1. Set up Authentication:
    You'll need to create a service account in the Google Cloud Console and download its JSON key file. This service account should have the necessary permissions to access the audit logs.
    Store the JSON key file securely on your server where your Node.js application runs.
    Use the google-auth-library Node.js library to authenticate your requests using the service account credentials.
  2. Make API Requests:
    Use the googleapis Node.js library to make requests to the Audit Logs API.
    Specifically, you'll use the cloudaudit.googleapis.com service in the googleapis library.