Viewing activity logs

Compute Engine activity logs are deprecated. Instead,useaudit logs. For more information, seeMigrating from activity logs to audit logs.

Beta

This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA products and features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.

Compute Engine activity logs aren't the same thing asaudit logs. Audit logs contain the same information aslegacy activity logs and more. We recommend you use audit logs instead ofactivity logs. If you are already using activity logs, readMigrating from activity logs to audit logs.

Compute Engine provides activity logs that let you track certainevents that affect your project, such as API calls and system events.Specifically, activity logs provide information about:

  • Compute Engine API calls:GCE_API_CALL events areAPI calls that change the state of aresource. For example, API calls to create a disk, update instance metadata,create an instance group, change a machine type, are recorded in activitylogs. API calls that do not update a resource, such asget andlistrequests aren't recorded.
  • Operation logs:GCE_OPERATION_DONE events are logged when an API callchanges the state of a resource finishes, Compute Engine returnsa completed operation event that is recorded in your activity logs.
  • System logs:GCE_SYSTEM_EVENT events are logged whenCompute Engine performs a system event, it is recorded in activitylogs. For example, a transparent maintenance event would be logged as asystem event.

For example, with an API event, an activity log provides details such asthe start and end time of an API request, the specifics of the request body,the authorized user who made the API request, and the request endpoint.You can download activity logs to search for specific API requests, orto review system events initiated by Compute Engine.

Activity logs do not provide billing or usage information abouta project, such as how long a virtual machine instance has been running or howmuch it costs. For billing logs, see thebilling export feature. Forusage logs, seeViewing usage reports.

Activity logs are provided as part of the Cloud Loggingservice. For more information about Logging in general, readtheCloud Logging documentation.

Before you begin

Permissions required for this task

To perform this task, you must have the followingpermissions:

  • logging.logServiceIndexes.list on the project
  • logging.logServices.list on the project

Viewing logs

Activity logging is enabled by default for all Compute Engineprojects.

You can see your project's activity logs through theLogs Explorerin theGoogle Cloud console:

  1. In the Google Cloud console, go to theLogging page.

    Go to the Logging page

  2. When in the Logs Explorer, select and filter your resource type from thefirst drop-down list.
  3. From theAll logs drop-down list, selectcompute.googleapis.com/activity_log to see Compute Engineactivity logs.

Routing logs

To learn how to export activity logs, readConfigure and manage sinks in theCloud Logging documentation.

Identifying log files

When you export logs into Cloud Storage, the log files are stored in thestructure described by theLog entry objectsdocumentation.

Compute Engine log files are stored with the following directorystructure:

<bucket>/compute.googleapis.com/activity_log/<year>/<month>/<day>

The following is an example log filename stored in a Cloud Storagebucket namedmy-bucket:

my-bucket/compute.googleapis.com/activity_log/2014/10/31/20:00:00_20:59:59_S0.json

In BigQuery, activity logs are stored in a set of tables, one table foreach log type and day, and the tables are named using the following format:

<dataset>.compute_googleapis_com_activity_log_YYYYMMDD

For information about how to query activity logs in BigQuery, seeLog entries in BigQuery.

Reading activity logs

Note: Compute Engine recently updated the format of activity logsto useprotobuf format.This changes the format of your logs slightly, but the contentremains the same.

Activity logs are structured as described in theLogEntry typedocumentation.

Compute Engine activity logs have:

  • compute.googleapis.com/activity_log as value of thelog field
  • metadata,which describes common information such as timestamp
  • structPayload, which contains the specific contents of the log entry

You can get more details about the common fields provided with every logentry from theLogEntrydescription, but the payload contents of activity log entries are specific toCompute Engine and are described below.

Payload contents

The contents of a log entry are provided in JSON object format, and are storedin thestructPayload field. ThestructPayload field contains the followinginformation:

FieldTypeDescription
actorstringEmail of user or service account performing the operation. This is thesame as theuser_id.
errorstringProvides any error details if an error occurred during this event.This is omitted if there were no errors. Errors usually prevent a requestfrom completing successfully. You can use this field to debug a failed request.
event_subtypestringDescribes the specific subtype as an API method.

For example, a request toinsert a new instanceappears ascompute.instances.insert, and a request todelete an Address resourceappears ascompute.addresses.delete.

See theAPI referencefor a comprehensive list of API methods.

event_timestamp_ustimestampThe timestamp, in microseconds, of the logged event since standard epoch.This is the same asmetadata.timestamp.
event_typestringDescribes the general event type.

This can be one of the following values:

  • GCE_API_CALL. Indicates a REST API call that updated aresource.
  • GCE_OPERATION_DONE. After an API request completes, whethersuccessful or not, this event type is logged.
  • GCE_SYSTEM_EVENT. A system event initiated byCompute Engine.
infostringAn optional field with additional information, if applicable. This fieldis omitted if there is no additional information to show.
operationstringWhen an API request is made to update or change any resources, a corresponding operation object is created to track the request to completion. This property describes the operation object for this event, providing information such as the operation name, the zone or region of the operation, and the operation ID.

Operations can be azone operation, aregion operation,or aglobal operation,depending on the resource the operation is modifying.

requestJSONContains the original API request body.

"request": {  "url": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-f/instances\",  "body": "{    \"canIpForward\":"false",    \"description\":\"\",    \"disks\":[{      \"autoDelete\":true,      \"boot\":true,      \"deviceName\":\"example-instance\",      \"initializeParams\":{        \"diskSizeGb\":\"10\",        \"diskType\":\"https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-f/diskTypes/pd-standard\",        \"sourceImage\":\"https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-8-jessie-v20150818\"      },      \"mode\":\"READ_WRITE\",      \"type\":\"PERSISTENT\"    }],    \"machineType\":\"https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-f/machineTypes/n1-standard-1\",    \"metadata\":{      \"items\":[]    },    \"name\":\"example-instance\",    \"networkInterfaces\":[{        \"accessConfigs\":[{          \"name\":\"External NAT\",          \"type\":\"ONE_TO_ONE_NAT\"        }],        \"network\":\"https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default\"      }],    \"scheduling\":{      \"automaticRestart\":true,      \"onHostMaintenance\":\"MIGRATE\",      \"preemptible\":false    },    \"serviceAccounts\":[{      \"email\":\"default\",      \"scopes\":[        \"https://www.googleapis.com/auth/devstorage.read_only\",        \"https://www.googleapis.com/auth/logging.write\"      ]    }],    \"tags\":{      \"items\":[]    },    \"zone\":\"https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-f\"  }"}

resourceJSONDescribes the particular resource that is being modified by this event.For example, a virtual machine (VM) instance is considered a resource and anexample resource property for a VM looks like the following:
"resource": {  "type": "instance",  "name": "example-instance",  "id": "0",  "zone": "us-central1-f"}

A list of resource types is described in detail in theAPI reference.

Note: If an action affects multiple resources,there may be multiple log entries with the sametrace_id.

trace_idstringA system-provided trace ID used to group related logs that are triggered bya single action. For example:
trace_id: "operation-1442436581415-51fe3700bd85a-7fd317e3-f1a3555e"
user_agentstringDescribes the client that performed this request. For example,if you used the Cloud Client Libraries for Java to make a request, the user agent would beGoogle-API-Java-Client.
versionstringThe current log format version indicates the Compute Enginelog schema. The current version is 1.2.

Note: The Compute Engine APIversioning is separate from the log format versioning.

warningstringProvides any warning details if any warnings occurred during this event. Awarning is informational and does not affect the request, unlike errors.

Sample log entry

For example, a sample log entry describing an API request to create aVM looks like the following:

{  "log": "compute.googleapis.com/activity_log",  "insertId": "2015-09-16|13:49:42.532185-07|10.106.9.208|335899593",  "metadata": {    "severity": "INFO",    "projectId": "835469197146",    "serviceName": "compute.googleapis.com",    "zone": "us-central1-f",    "labels":{      "compute.googleapis.com/resource_id":"0",      "compute.googleapis.com/resource_name":"example-instance",      "compute.googleapis.com/resource_type":"instance",      "compute.googleapis.com/resource_zone":"us-central1-f"    },    "timestamp": "2015-09-16T20:49:42.423637Z"  },  "structPayload": {    "version": "1.2",    "trace_id": "operation-1442436581415-51fe3700bd85a-7fd317e3-f1a3555e",    "event_timestamp_us": "1442436582423637",    "event_type": "GCE_API_CALL",    "event_subtype": "compute.instances.insert",    "resource": {      "type": "instance",      "name": "example-instance",      "id": "0",      "zone": "us-central1-f"    },    "actor": {      "user": "user@example.com"    },    "ip_address": "",    "user_agent": "apitools-client/1.0",    "request": {      "url": "https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-f/instances",      "body": "{        \"canIpForward\":false,        \"description\":\"\",        \"disks\":[{          \"autoDelete\":true,          \"boot\":true,          \"deviceName\":\"example-instance\",          \"initializeParams\":{            \"diskSizeGb\":\"10\",            \"diskType\":\"https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-f/diskTypes/pd-standard\",            \"sourceImage\":\"https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-8-jessie-v20150818\"          },          \"mode\":\"READ_WRITE\",          \"type\":\"PERSISTENT\"        }],        \"machineType\":\"https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-f/machineTypes/n1-standard-1\",        \"metadata\":{          \"items\":[]        },        \"name\":\"example-instance\",        \"networkInterfaces\":[{            \"accessConfigs\":[{              \"name\":\"External NAT\",              \"type\":\"ONE_TO_ONE_NAT\"            }],            \"network\":\"https://www.googleapis.com/compute/v1/projects/myproject/global/networks/default\"          }],        \"scheduling\":{          \"automaticRestart\":true,          \"onHostMaintenance\":\"MIGRATE\",          \"preemptible\":false        },        \"serviceAccounts\":[{          \"email\":\"default\",          \"scopes\":[            \"https://www.googleapis.com/auth/devstorage.read_only\",            \"https://www.googleapis.com/auth/logging.write\"          ]        }],        \"tags\":{          \"items\":[]        },        \"zone\":\"https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-f\"      }"    },    "operation": {      "type": "operation",      "name": "operation-1442436581415-51fe3700bd85a-7fd317e3-f1a3555e",      "id": "291347737657178184",      "zone": "us-central1-f"    }  }}

Deprecated activity log entries

The following activity log entries will be discontinued, with no replacement,on June 1, 2020:

Monitored Resource TypeEvent SubType
gce_backend_serviceBackendServiceConfigProgramming
gce_instanceRE_ENCRYPT_SSL_CERTIFICATE_FLOW
gce_instanceaddFirewallRuleToSecurityPolicy
gce_instanceattachCloudLink
gce_instanceattachFirewallSecurityPolicy
gce_instancecompute.instanceGroupManagers.updateHealth
gce_instancecompute.instanceGroups.detachHealthCheck
gce_instancecompute.instanceNetworkConfig.updateName
gce_instancecompute.regionInstanceGroups.attachHealthCheck
gce_instancecompute.regionInstanceGroups.detachHealthCheck
gce_instancecreateFirewallSecurityPolicy
gce_instancedeleteFirewallSecurityPolicy
gce_instancedetachFirewallSecurityPolicy
gce_instancepatchFirewallRuleInSecurityPolicy
gce_instanceremoveCloudLink
gce_instanceremoveFirewallRuleFromSecurityPolicy
gce_instanceupdateFirewallSecurityPolicy
gce_instanceupdateVpnTunnel
gce_instance_groupcompute.instanceGroups.attachHealthCheck
gce_instance_groupcompute.instanceGroups.attachNetworkInterfaces
gce_instance_groupcompute.instanceGroups.detachHealthCheck
gce_instance_groupcompute.regionInstanceGroups.attachHealthCheck
gce_instance_groupcompute.regionInstanceGroups.detachHealthCheck
gce_instance_templatecompute.zoneInstanceTemplates.insert
gce_networkcompute.networks.switchLegacyToCustomMode
gce_projectcompute.projects.moveProjectNetworking
gce_reserved_addresscompute.addresses.insertDnsForwarding
gce_reserved_addresscompute.addresses.insertNatAddress
gce_ssl_certificateRE_ENCRYPT_SSL_CERTIFICATE_FLOW
gce_ssl_certificateSslCertificateAddManagedCertificateChallenge
gce_ssl_certificateSslCertificateProvisionManagedCertificate
gce_ssl_certificateSslCertificateRemoveManagedCertificateChallenge
gce_subnetworkcompute.subnetworks.createOrUpdateVirtualSubnetwork
vpn_tunnelupdateVpnTunnel

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.