View log messages for callouts

This page describes logging for Application Load Balancer callouts.

For a product overview, see Service Extensions overview.

Enable logging for callouts

You can enable logging for Application Load Balancer callouts while creating the service by enabling logging on the backend service that's the target of a request (and not on the backend service associated with the extension).

To enable logging for the target backend service for a regional internal Application Load Balancer, use the gcloud compute backend-services update command.

gcloud compute backend-services update BACKEND_SERVICE \
    --enable-logging \
    --logging-sample-rate=RATE \
    --region=REGION \
    --logging-optional=LOGGING_OPTIONAL_MODE \
    --logging-optional-fields=OPTIONAL_FIELDS

Replace the following:

  • BACKEND_SERVICE: the name of the backend service
  • RATE: a value from 0.0 through 1.0, where 0.0 means no requests are logged and 1.0 means 100% of requests are logged. The default value is 1.0. This setting is effective only when used with the enable-logging parameter. When you omit enable-logging, logging is disabled.
  • REGION: the region of the backend
  • LOGGING_OPTIONAL_MODE: enables logging for optional fields in one of these modes:

    • INCLUDE_ALL_OPTIONAL includes all optional fields.

    • EXCLUDE_ALL_OPTIONAL (default) excludes all optional fields.

    • CUSTOM includes a custom list of optional fields.

  • OPTIONAL_FIELDS: a comma-separated list of optional fields when you select the CUSTOM mode

For more information, see the Monitor and troubleshoot pages of Application Load Balancer documentation, such as Internal Application Load Balancer logging and monitoring.

After you enable logging on the backend service, HTTP or HTTPS requests are logged by using Cloud Logging logs requests.

To view logs, in the Google Cloud console, go to the Logs Explorer page.

What is logged for callouts

In general, Application Load Balancer log entries contain information useful for monitoring and debugging your HTTP or HTTPS traffic. Log entries contain the following types of information:

  • Information shown in most Google Cloud logs, such as severity, project ID, project number, and timestamp as described in the LogEntry.
  • HttpRequest log fields.

Request logs for HTTP and HTTPS load balancers contain a service_extension_info object in the load balancer log entry JSON payload with the following information:

Field Type Description
backend_target_name string Name of the backend target of the extension
backend_target_type string Type of the backend target
chain string Name of the extension chain within the service extension resource that matches the request
extension string Name of the extension within the extension chain
per_processing_request_info array Information about each ProcessingRequest message that's sent to the ext_proc server
per_processing_request_info[].event_type enum The event type of ProcessingRequest. Can be one of these: REQUEST_HEADERS, REQUEST_BODY, RESPONSE_HEADERS, or RESPONSE_BODY.
per_processing_request_info[].grpc_status enum The most recent status on the gRPC stream. For more information, see gRPC status codes.
per_processing_request_info[].latency duration The duration from when the first byte of the ProcessingRequest message is sent to the extension to when the last byte of the ProcessingResponse message is received.
resource string Name of the extension resource

What's next