Method: instances.getSerialPortOutput

Returns the last 1 MB of serial port output from the specified instance.

HTTP request

GET https://compute.googleapis.com/compute/v1/projects/{project}/zones/{zone}/instances/{instance}/serialPort

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
project

string

Project ID for this request.

zone

string

The name of the zone for this request.

instance

string

Name of the instance for this request.

Query parameters

Parameters
port

integer

Specifies which COM or serial port to retrieve data from.

start

string (int64 format)

Specifies the starting byte position of the output to return. To start with the first byte of output to the specified port, omit this field or set it to 0.

If the output for that byte position is available, this field matches the start parameter sent with the request. If the amount of serial console output exceeds the size of the buffer (1 MB), the oldest output is discarded and is no longer available. If the requested start position refers to discarded output, the start position is adjusted to the oldest output still available, and the adjusted start position is returned as the start property value.

You can also provide a negative start position, which translates to the most recent number of bytes written to the serial port. For example, -3 is interpreted as the most recent 3 bytes written to the serial console. Note that the negative start is bounded by the retained buffer size, and the returned serial console output will not exceed the max buffer size.

Request body

The request body must be empty.

Response body

An instance serial console output.

If successful, the response body contains data with the following structure:

JSON representation
{
  "kind": string,
  "contents": string,
  "start": string,
  "next": string,
  "selfLink": string
}
Fields
kind

string

[Output Only] Type of the resource. Always compute#serialPortOutput for serial port output.

contents

string

[Output Only] The contents of the console output.

start

string (int64 format)

The starting byte position of the output that was returned. This should match the start parameter sent with the request. If the serial console output exceeds the size of the buffer (1 MB), older output is overwritten by newer content. The output start value will indicate the byte position of the output that was returned, which might be different than the start value that was specified in the request.

next

string (int64 format)

[Output Only] The position of the next byte of content, regardless of whether the content exists, following the output returned in the contents property. Use this value in the next request as the start parameter.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/compute.readonly
  • https://www.googleapis.com/auth/compute
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

In addition to any permissions specified on the fields above, authorization requires one or more of the following IAM permissions:

  • compute.instances.getSerialPortOutput

To find predefined roles that contain those permissions, see Compute Engine IAM Roles.