Cloud Vision audit logging information

This page describes the audit logs created by Vision as part of Cloud Audit Logging.

Overview

Google Cloud Platform services write audit logs to help you answer the questions, "Who did what, where, and when?" Your GCP projects each contain only the audit logs for resources that are directly within the project. Other entities, such as folders, organizations, and billing accounts, each contain the audit logs for the entity itself.

For a general overview of Cloud Audit Logging, see Cloud Audit Logging. For a deeper understanding of Cloud Audit Logging, see Understanding audit logs.

Cloud Audit Logging maintains three audit logs for each GCP project, folder, and organization:

  • System Event audit logs
  • Admin Activity audit logs
  • Data Access audit logs

Vision writes System Event audit logs, containing log entries for when Compute Engine performs a system event. Vision provides these logs by default.

Vision writes audit logs for Admin Activity, which includes operations that modify the configuration or metadata of a resource. Vision provides these logs by default.

Data Access audit logs are not available for Vision.

Audited operations

The following table summarizes which API operations correspond to each audit log type in Vision:

Audit logs category Vision operations
Admin activity logs images.annotate

Audit log format

Audit log entries—which can be viewed in Stackdriver Logging using the Logs Viewer, the Stackdriver Logging API, or the Cloud SDK—include the following objects:

  • The log entry itself, which is an object of type LogEntry. Useful fields include the following:

    • logName contains the project identification and audit log type
    • resource contains the target of the audited operation
    • timeStamp contains the time of the audited operation
    • protoPayload contains the audited information
  • The audit logging data, which is an AuditLog object held in the protoPayload field of the log entry.

  • Optional service-specific audit information, which is a service-specific object held in the serviceData field of the AuditLog object. For details, see Service-specific audit data.

For other fields in these objects, sample contents of them, and sample queries on information in the objects, see Audit Log Datatypes.

Log name

Cloud Audit Logging resource names indicate the project or other entity that owns the audit logs, and whether the log contains Admin Activity, Data Access, or System Event audit logging data. For example, the following shows log names for a project's Admin Activity logs and an organization's Data Access logs:

projects/[PROJECT_ID]/logs/cloudaudit.googleapis.com%2Factivity
organizations/[ORGANIZATION_ID]/logs/cloudaudit.googleapis.com%2Fdata_access

Service name

Vision audit logs use the service name vision.googleapis.com.

For more details on logging services, see Mapping services to resources.

Resource types

Vision audit logs use the resource type audited_resource for all audit logs.

For a full list, see Monitored Resource Types.

Enabling audit logging

System Event logs are enabled by default and cannot be disabled.

Admin Activity audit logs are enabled by default and cannot be disabled.

Data Access logs are not available for Vision.

Audit log permissions

Cloud Identity and Access Management permissions and roles determine which audit logs you can view or export. Logs reside in projects and in some other entities including organizations, folders, and billing accounts. For more information, see Understanding roles.

To view Admin Activity logs, you must have one of the following Cloud IAM roles in the project that contains your audit logs:

Data Access logs are not available for Vision.

To view System Event logs, you must have one of the following Cloud IAM roles in the project that contains your audit logs:

If you are using audit logs from a non-project entity, such as an organization, then change the Project roles to suitable organization roles.

Viewing logs

You have several options for viewing your audit log entries:

Basic Viewer

You can use the Logs Viewer basic interface in the GCP Console to retrieve your audit log entries. Do the following:

  1. Go to the Stackdriver Logging > Logs (Logs Viewer) page in the GCP Console:

    Go to the Logs Viewer page

  2. Select an existing GCP project at the top of the page, or create a new project.

  3. In the first drop-down menu, select the resource type whose audit logs you wish to see. You can select a specific resource or Global for all resources.

  4. In the second drop-down menu, select the log type you want to see: activity for Admin Activity audit logs,data_accessfor Data Access audit logs, and system_events for System Event logs.

    If you do not see any of those options, then there are no audit logs of that type available in the project.

Advanced Viewer

You can use the Logs Viewer advanced interface in the GCP Console to retrieve your audit log entries. Do the following:

  1. Go to the Stackdriver Logging > Logs (Logs Viewer) page in the GCP Console:

    Go to the Logs Viewer page

  2. Select an existing GCP project at the top of the page, or create a new project.

  3. In the first drop-down menu, select the resource type whose audit logs you wish to see. You can select a specific resource or Global for all resources.

  4. Click the drop-down arrow (▾) at the far right of the search-filter box and select Convert to advanced filter.

  5. Create a filter that further specifies the log entries you want to see. To retrieve all audit logs in your project, add the following filter. Supply a valid [PRODUCT_ID] in each of the log names.

      logName = ("projects/[PROJECT_ID]/logs/cloudaudit.googleapis.com%2Factivity" OR
          OR "projects/[PROJECT_ID]/logs/cloudaudit.googleapis.com%2Fsystem_events"
          OR "projects/[PROJECT_ID]logs/cloudaudit.googleapis.com%2Fdata_access")
    

    For more details about filters, see Advanced logs filters.

API

To look at your audit log entries using the Stackdriver Logging API:

  1. Go to the Try this API section in the documentation for the entries.list method.

  2. Put the following into the Request body part of the Try this API form. Clicking on this prepopulated form automatically fills the request body, but you will need to supply a valid [PRODUCT_ID] in each of the log names.

      {
        "resourceNames": [
          "projects/[PROJECT_ID]"
        ],
        "pageSize": 5,
        "filter": "logName=(projects/[PROJECT_ID]/logs/cloudaudit.googleapis.com%2Factivity OR projects/[PROJECT_ID]/logs/cloudaudit.googleapis.com%2Fsystem_events OR projects/[PROJECT_ID]/logs/cloudaudit.googleapis.com%2Fdata_access)"
      }
    
  3. Click Execute.

For more details about filters, see Advanced logs filters.

SDK

To read your log entries using the Cloud SDK, run the following command. Supply a valid [PRODUCT_ID] in each of the log names.

gcloud logging read "logName=(projects/[PROJECT_ID]/logs/cloudaudit.googleapis.com%2Factivity OR projects/[PROJECT_ID]/logs/cloudaudit.googleapis.com%2Fsystem_events OR projects/[PROJECT_ID]/logs/cloudaudit.googleapis.com%2Fdata_access)

See Reading log entries for more information about using the Cloud SDK.

To see a sample audit log entry and learn how to find the most important information in it, see Understanding audit logs.

Exporting audit logs

You can export audit logs in the same way you export other kinds of logs. For details about how to export your logs, see Exporting logs. Here are some applications of exporting audit logs:

  • To keep audit logs for a longer period of time or to use more powerful search capabilities, you can export copies of your audit logs to Cloud Storage, BigQuery, or Cloud Pub/Sub. Using Cloud Pub/Sub, you can export to other applications, other repositories, and to third parties.

  • To manage your audit logs across an entire organization, you can create aggregated export sinks that can export logs from any or all projects in the organization.

Pricing

Stackdriver Logging does not charge you for audit logs that are enabled by default, including all Admin Activity and System Event logs.

For more information on logs pricing, including audit logs pricing, see Stackdriver pricing.

¿Te ha resultado útil esta página? Enviar comentarios:

Enviar comentarios sobre...

Cloud Vision API Documentation
Si necesitas ayuda, visita nuestra página de asistencia.