Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Linux
Windows
Wenn Sie eine Compute Engine API aufrufen, bei der eine Ressource mutiert wird, fügt die Compute Engine der Liste der Vorgänge einen Eintrag hinzu. Wenn Sie beispielsweise eine Aktualisierung einer VM vornehmen, bei der Daten mutiert (geändert) werden, oder wenn ein Hostereignis auftritt, das den Status einer VM ändert, werden Vorgänge erstellt. Auf dieser Seite wird beschrieben, wie Sie eine Liste der Compute Engine-Vorgänge mithilfe der Google Cloud -Konsole, der Google Cloud CLI oder von REST aufrufen können.
Beachten Sie, dass das Abschließen von Vorgängen einige Zeit in Anspruch nehmen kann. Daher werden während der Anzeige möglicherweise unvollständige Vorgänge angezeigt. Wenn Sie den endgültigen Status von nicht abgeschlossenen Vorgängen sehen möchten, wird nicht empfohlen, die Vorgänge wiederholt aufzurufen. Stattdessen sollten Sie warten, bis die Vorgänge abgeschlossen sind.
Hinweise
Richten Sie die Authentifizierung ein, falls Sie dies noch nicht getan haben.
Bei der Authentifizierung wird Ihre Identität für den Zugriff auf Google Cloud -Dienste und APIs überprüft.
Zum Ausführen von Code oder Beispielen aus einer lokalen Entwicklungsumgebung können Sie sich so bei der Compute Engine authentifizieren:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
gcloud
Installieren Sie die Google Cloud CLI.
Initialisieren Sie die Google Cloud CLI nach der Installation mit dem folgenden Befehl:
Wenn Sie die REST API-Beispiele auf dieser Seite in einer lokalen Entwicklungsumgebung verwenden möchten, verwenden Sie die Anmeldedaten, die Sie der gcloud CLI bereitstellen.
Installieren Sie die Google Cloud CLI.
Initialisieren Sie die Google Cloud CLI nach der Installation mit dem folgenden Befehl:
Beachten Sie beim Abfragen von Vorgängen, dass abgeschlossene Vorgänge nach einem bestimmten Zeitraum automatisch aus der Datenbank entfernt werden.
In der Compute Engine werden abgeschlossene Vorgänge mindestens 1 Stunde und maximal 14 Tage aufbewahrt.
Obwohl Projekte häufig eine längere Aufbewahrungsdauer als das Minimum von 1 Stunde für abgeschlossene Vorgänge vorsehen, wird eine zusätzliche Aufbewahrungsdauer nicht empfohlen.
Die Aufbewahrungsfristen gelten nicht für Vorgänge, die von Nutzern über die Methode Operations.delete gelöscht wurden.
Vorgänge anzeigen
Führen Sie die folgenden Schritte aus, um eine Liste der Vorgänge für Ihr Projekt aufzurufen:
Console
Rufen Sie in der Google Cloud Console die Seite Vorgänge auf.
Klicken Sie für weitere Informationen zu einem Vorgang auf die Vorgangszusammenfassung. Wenn Sie beispielsweise die Migrationsdetails für die VM my-instance sehen möchten, klicken Sie auf den Vorgang Automatically migrate an instance (Instanz automatisch migrieren).
gcloud
Verwenden Sie den Unterbefehl operations list, um mit gcloud compute eine Liste der Vorgänge für Ihr Projekt anzusehen.
Wenn Sie die Liste der Vorgänge in einer bestimmten Zone ansehen möchten, fügen Sie das Flag --filter hinzu.
gcloud compute operations list --filter="zone:(ZONE)"
Ersetzen Sie ZONE durch die Zone, in der Sie die Liste der Vorgänge ansehen möchten. Führen Sie beispielsweise den folgenden Befehl aus, um die Liste der Vorgänge in us-cental1-c anzusehen:
gcloud compute operations list --filter="zone:(us-central1-c)"
Die Ausgabe sieht in etwa so aus:
NAME TYPE TARGET HTTP_STATUS STATUS TIMESTAMP
systemevent-1543845145000... compute.instances.migrateOnHostMaintenance us-central1-c/instances/my-instance 200 DONE 2018-12-03T05:52:25.000-08:00
REST
API-Anfragen für Vorgänge müssen entweder auf globaler, regionaler oder zonaler Ebene angegeben werden.
Die Live-Migration, die Beendigung der VM und die automatischen Neustarts sind Vorgänge auf Zonenebene.
Stellen Sie für Zonenvorgänge eine GET-Anfrage an die Methode zoneOperations.list.
GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/operations
Ersetzen Sie dabei Folgendes:
PROJECT_ID: die Projekt-ID für diese Anfrage
ZONE: die Zone für diese Anfrage
Lassen Sie den Anfragetext leer.
Das folgende Beispiel zeigt die Ausgabe für eine Zonenvorgangsanfrage. In dieser Ausgabe sind Details zu einer Hostmigration angegeben.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-19 (UTC)."],[[["\u003cp\u003eCompute Engine operations are logged when a resource is mutated, such as during VM updates or host events, which alter the state of a VM.\u003c/p\u003e\n"],["\u003cp\u003eOperations can be viewed using the Google Cloud console, the Google Cloud CLI (gcloud), or REST, and they may be incomplete upon initial viewing.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication is only needed for gcloud or REST usage, and the provided steps outline the necessary commands for both.\u003c/p\u003e\n"],["\u003cp\u003eCompleted operations are retained for a period ranging from a minimum of 1 hour to a maximum of 14 days, during which time they are available for viewing.\u003c/p\u003e\n"],["\u003cp\u003eTo view operations, you must specify the scope of the request as either global, region, or zone level using gcloud or REST.\u003c/p\u003e\n"]]],[],null,["# View Compute Engine operations\n\nLinux Windows\n\n*** ** * ** ***\n\nWhen you call a Compute Engine API that mutates a resource, Compute Engine adds an entry\nto the list of operations. For example, when you make an update to a VM that\nmutates (alters) data, or when a [host event](/compute/docs/instances/host-maintenance-overview)\noccurs that changes the state of a VM, operations are created. This page\ndescribes how you can view a list of Compute Engine operations by\nusing the [Google Cloud console](https://console.cloud.google.com/), the [Google Cloud CLI](/compute/docs/gcloud-compute),\nor [REST](/compute/docs/reference/rest/v1).\n\nRemember that operations can take some time to complete, so you may find\nincomplete operations while viewing. When you want to see the final status of\nincomplete operations, repeatedly viewing operations is not recommended;\ninstead, you should [wait for operations to be done](/compute/docs/api/best-practices#wait-for-operations).\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\nOperation Retention Period\n--------------------------\n\nWhile querying operations, keep in mind that completed operations are\nautomatically removed from the database after a certain period.\n\nCompute Engine retains completed operations for at least the minimum\nretention period of 1 hour, and up to the maximum retention period of 14 days.\nAlthough projects often observe a retention period for completed operations that\nis longer than the minimum of 1 hour, depending on the additional retention\nperiod is not recommended.\n\nNote that the retention periods don't apply to operations deleted by the users\nthrough `Operations.delete` method.\n\nViewing operations\n------------------\n\nTo view a list of operations for your project, perform the following steps: \n\n### Console\n\n1. In the Google Cloud console, go to the **Operations** page.\n\n [Go to Operations](https://console.cloud.google.com/compute/operations)\n2. For more details on an operation, click the operation summary. For\n example, to view the migration details for the `my-instance` VM,\n click the **Automatically migrate an instance** operation.\n\n\n### gcloud\n\nTo view a list of operations for your project\nusing `gcloud compute`, use the [`operations list`](/sdk/gcloud/reference/compute/operations/list)\nsub-command.\n\nTo view the list of operations in a specified zone, add the `--filter` flag.\n\n\u003cbr /\u003e\n\n```\ngcloud compute operations list --filter=\"zone:(ZONE)\"\n```\n\n\u003cbr /\u003e\n\nReplace \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e with the zone where you want to view a list of\noperations. For example, to view the list of operations in `us-cental1-c`,\nrun the following command: \n\n```\ngcloud compute operations list --filter=\"zone:(us-central1-c)\"\n```\n\nThe output is similar to the following: \n\n```\nNAME TYPE TARGET HTTP_STATUS STATUS TIMESTAMP\nsystemevent-1543845145000... compute.instances.migrateOnHostMaintenance us-central1-c/instances/my-instance 200 DONE 2018-12-03T05:52:25.000-08:00\n```\n\n\u003cbr /\u003e\n\n### REST\n\nAPI requests for operations must be specified at either the [global](/compute/docs/reference/rest/v1/globalOperations/list),\n[region](/compute/docs/reference/rest/v1/regionOperations/list), or [zone](/compute/docs/reference/rest/v1/zoneOperations/list) level.\nLive migration, VM stopping, and automatic restarts are all zone-level operations.\n\nFor zone operations, make a `GET` request to the [`zoneOperations.list`](/compute/docs/reference/rest/v1/zoneOperations/list) method. \n\n```\nGET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/operations\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID for this request\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone for this request\n\nLeave the request body empty.\n\nThe following is a sample output for a zone operation request. In this\noutput, details for a host migration displays. \n\n```\n{\n \"kind\": \"compute#operation\",\n \"id\": \"3216798767364213712\",\n \"name\": \"systemevent-1543845145000-57c1e7574b840-a195b637-5ff74d9b\",\n \"zone\": \"https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c\",\n \"operationType\": \"compute.instances.migrateOnHostMaintenance\",\n \"targetLink\": \"https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/instances/my-instance\",\n \"targetId\": \"3070988523247098025\",\n \"status\": \"DONE\",\n \"statusMessage\": \"Instance migrated during Compute Engine maintenance.\",\n \"user\": \"system\",\n \"progress\": 100,\n \"insertTime\": \"2018-12-03T05:52:25.000-08:00\",\n \"startTime\": \"2018-12-03T05:52:25.000-08:00\",\n \"endTime\": \"2018-12-03T05:52:25.000-08:00\",\n \"selfLink\": \"https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/operations/systemevent-1543845145000-57c1e7574b840-a195b637-5ff74d9b\"\n}\n```"]]