This page shows you how to configure and use Cloud Logging and Cloud Monitoring with Service Extensions callouts for Cloud Load Balancing.
Logging
This section describes logging for Application Load Balancer callouts.
Enable logging on a backend service
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, 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 from0.0through1.0, where0.0means no requests are logged and1.0means 100% of requests are logged. The default value is1.0. This setting is effective only when used with theenable-loggingparameter. When you omitenable-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_OPTIONALincludes all optional fields. -
EXCLUDE_ALL_OPTIONAL(default) excludes all optional fields. -
CUSTOMincludes a custom list of optional fields.
-
-
OPTIONAL_FIELDS: a comma-separated list of optional fields when you select theCUSTOMmode
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 the Logs Explorer page.
For more information, see the "Monitor and troubleshoot" pages of the Application Load Balancer documentation, such as Internal Application Load Balancer logging and monitoring .
Log messages for a backend service
In general, Application Load Balancer log entries contain information that is 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 log.
- 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:
backend_target_name
backend_target_type
chain
extension
failed_open
failOpen
set to true
, the value true
for this metric indicates that
processing continued when the extension timed out or failed. Applies only to regional external Application Load Balancers, regional internal Application Load Balancers, and cross-region internal Application Load Balancers.
grpc_status
per_processing_request_info
ProcessingRequest
stats for ext_proc
extensions
or CheckRequest
stats for ext_authz
extensions that occur over
the gRPC stream.per_processing_request_info[].event_type
ProcessingRequest
. Can be one of these: REQUEST_HEADERS
, REQUEST_BODY
, RESPONSE_HEADERS
, or RESPONSE_BODY
.per_processing_request_info[].latency
ProcessingRequest
message is sent to the extension to when the last byte of the ProcessingResponse
message is received.per_processing_request_info[].processing_effect
Can be one of the following values:
-
NONE: indicates that contents were not changed. -
NONE_FAILED_OPEN: indicates that no mutations were performed because the extension failed open. -
CONTENT_MODIFIED: indicates that content was changed by a successfully applied mutation request. -
IMMEDIATE_RESPONSE: indicates that an immediate response was sent by the extension to halt all further processing. -
MUTATION_REJECTED: indicates that the extension requested at least one disallowed change and further processing was discontinued. Appropriate error messages are logged. -
UNSPECIFIED: indicates that the effect of processing is not known.
per_processing_request_info[].processing_effect_details
processing_effect
is MUTATION_REJECTED
, the details about
why a mutation was rejected. Applies only to regional external Application Load Balancers, regional internal Application Load Balancers, and cross-region internal Application Load Balancers.
resource
Monitoring
This section describes how to monitor callouts configured using Service Extensions for Cloud Load Balancing.
View a Monitoring dashboard
Application Load Balancers export monitoring data to Cloud Monitoring .
Use Monitoring metrics for the following purposes:
- Evaluating a load balancer's configuration, usage, and performance
- Troubleshooting problems
- Improving resource utilization and user experience
To view a predefined dashboard, follow these steps:
- In the Google Cloud console, go to the Dashboards overview page.
- In the Categories
section, click GCP
.
- To view a list of dashboards for all your load balancers, in the GCP Dashboards list, click the dashboard named Google Cloud Load Balancers . To view a specific load balancer's dashboard, locate the load balancer in the list and click its name.
- To view the predefined dashboards for only your load balancers, select the appropriate dashboard.
In addition to the predefined dashboards in Monitoring, you can create custom dashboards, set up alerts, and query the metrics through the Cloud Monitoring API .
For more information, see the "Monitor and troubleshoot" pages of the Application Load Balancer documentation, such as Internal Application Load Balancer logging and monitoring .
Monitoring metrics for callouts
You can monitor the following metrics for callout backend services.
In Preview
, you can monitor the following metrics
for extensions on regional external Application Load Balancers, regional internal Application Load Balancers, and
cross-region internal Application Load Balancers. These metrics have the prefix networkservices.googleapis.com
. The prefix is omitted from the entries in the following table.
The following table provides the metric type, display name, kind, type, unit, and description for each metric.
| Metric type | Display name Kind, Type, Unit Description |
|---|---|
extension/invocation_count
|
Extension invocation countDELTA
, INT64
, 1
The number of invocations sent to the extension. |
extension/invocation_latencies
|
Extension invocation latenciesDELTA
, DISTRIBUTION
, ms
The distribution calculated from the latency of each extension invocation. |
extension/sent_chunks_count
|
Extension sent chunks countDELTA
, INT64
, 1
Applicable only for request_body
and response_body
events.
The number of data chunks sent to the extension. |
extension/received_chunks_count
|
Extension received chunks countDELTA
, INT64
, 1
Applicable only for request_body
and response_body
events.
The number of chunks received from the extension. |
extension/failed_open_count
|
Extension failed invocations with fail-openDELTA
, INT64
, 1
The number of times that an invocation failed when the system was configured to fail open and the request was allowed to proceed. |
extension/mutation_rejections
|
Extension mutation rejections countDELTA
, INT64
, 1
The number of invocations that requested header, body, or trailer mutations but were rejected. Rejections can occur for a variety of reasons, such as when the mutation is invalid or exceeds size limits. |
extension/sent_bytes_count
|
Extension sent bytes countDELTA
, INT64
, By
The number of bytes sent to the extension. |
extension/received_bytes_count
|
Extension received bytes countDELTA
, INT64
, By
The number of bytes received from the extension. |
You can also monitor the following metrics. These metrics have the prefix loadbalancing.googleapis.com/
. The prefix is omitted
from the entries in the table.
| Metric type | Display name Kind, Type, Unit Description |
|---|---|
https/backend_request_count
,https/external/regional/backend_request_count
,https/internal/backend_request_count
|
Backend request countDELTA
, INT64
, 1
The number of times that a callout backend service is called from the Application Load Balancer. |
https/backend_request_bytes_count
,https/external/regional/backend_request_bytes_count
,https/internal/backend_request_bytes_count
|
Backend request bytesDELTA
, INT64
, By
The number of bytes sent from the load balancer to the callout backend service. |
https/backend_response_bytes_count
,https/external/regional/backend_response_bytes_count
,https/internal/backend_response_bytes_count
|
Backend response bytesDELTA
, INT64
, By
The number of bytes received by the load balancer from the extension backend. |
https/backend_latencies
,https/external/regional/backend_latencies
,https/internal/backend_latencies
|
Backend latencyDELTA
, DISTRIBUTION
, ms
A distribution calculated from the sum of latencies of each extension invocation between the load balancer and the callout backend service. Sampled every 60 seconds. |

