External passthrough Network Load Balancer logging and monitoring

This document shows you how to configure and useCloud LoggingandCloud Monitoring for external passthrough Network Load Balancers.

Backend service-based external passthrough Network Load Balancers support both Loggingand Monitoring. However, target pool-based external passthrough Network Load Balancerssupport only Monitoring.

Logging

Logs provide useful information for troubleshootingand monitoring your backend service-based external passthrough Network Load Balancer. Logs areaggregated per connection and exported in near real time. Logs are generated foreach load-balanced instance's TCP, UDP, ESP, GRE, ICMP, and ICMPv6 flows for bothingress and egress traffic. For more information about the fields provided inthe log entry, seeLog fields.

There are no additional charges for using logs. Based on how you importlogs, standard pricing forCloud Logging,BigQuery, or Pub/Sub apply. Enabling logs has no effect on theperformance of the load balancer.

Logging provides the following benefits:

  • External passthrough Network Load Balancer traffic monitoring. Per-connection logging gives you insight into how eachconnection is routed to serving backends.

  • Network troubleshooting. You can utilize external passthrough Network Load Balancer logs for troubleshooting.For more information, seeTroubleshoot external passthrough Network Load Balancers.

Sample log format for an external client to VM flows

The following diagram shows the inbound and outbound traffic for an externalclient (203.0.113.7), external passthrough Network Load Balancer (198.51.100.99),and backend instance (10.240.0.2).

External client to backend VM services flows.
Inbound and outbound flows for an external client to VM.

External passthrough Network Load Balancer logs for connections from the client to the backendinstance are formatted as follows:

  • connection.clientIp: 203.0.113.7
  • connection.serverIp: 198.51.100.99
  • bytesSent: 1256
  • bytesReceived: 4521

Logs sampling and collection

Google Cloud samples the packets that leave and enter load balancer backendVMs. Those sampled packets are processed to generate logs.

Not every packet is sampled. Google Cloud samples a variable subset ofpackets depending on the amount of traffic on the physical host.The lowest possible sampling rate is one out of 1,024 packets. The sampling rateis dynamically controlled by Google Cloud. You cannot adjust the samplingrate.

The packet sampling interacts with firewall rules in the following ways:

  • Packets are sampledbefore egress firewall rules are applied.
  • Packets are sampledafter ingress firewall rules are applied.

After packet sampling, Google Cloud processes the sampled packetsaccording to the following procedure:

  1. Aggregation: Sampled packets are aggregated over a five-second intervalto produce a single flow entry.

  2. Configurable (secondary) log sampling: This is a second samplingprocess, sampling the flows. You control the fraction of the flow entriesthat are emitted as log entries according to thelogConfig.sampleRateparameter. WhenlogConfig.sampleRate is1.0 (100%), this means thatallof the sampled packets are processed.

  3. Write to logging: The log entries are written to Cloud Logging.

Optional fields

Log records contain required fields and optional fields. TheLogfields section lists which fields are optional and which are required. All requiredfields are always included. You can customize which optional fields you keep.

  • If you selectinclude all optional, all optional fields in the logrecord format are included in the flow logs. When new optional fields are addedto the record format, the flow logs automatically include the new fields.

  • If you selectexclude all optional, this omits all optional fields.

  • If you selectcustom, you can specify the optional fieldsthat you want to include by the parent field, such asserverInstance, or bytheir full names, such asserverInstance.vm.

When new optional fields are added to the record format, the logs won'tinclude these fields, unless they are a new field within a parent field thatyou have specified to include.

If you specify a custom optional field using parent fields, when new optionalfields are added to the record format within that parent field, the logs willautomatically include the new fields. For example, if you choose to includeoptionalFieldA, then a new field added to the logs with the nameoptionalFieldA.subField1 will be included automatically.

For instructions about customizing optional fields, seeEnable logging on a new backend service.

Response packet source IP address requirements

Logging samples the response packets from the backendVMs only if the source IP address for those packets matches the load balancer'sforwarding rule IP address.For TCP connections, response packets must always have sources that match therequest packet's destination; however, for other protocols, it's possible forresponse packets to use a different source IP address.For more information, seeIP addresses for request and return packets.

The packet sampling process used by external passthrough Network Load Balancer logging omits anyresponse packets from backend VMs if those response packets have sources thatdon't match an IP address of a forwarding rule for an external passthrough Network Load Balancer.

Enable logging on a new backend service

Console

  1. In the Google Cloud console, go to theLoad balancing page.

    Go to Load balancing

  2. Click the name of your load balancer.
  3. ClickEdit, and then clickBackend Configuration.
  4. SelectCreate a backend service, and then complete the required backend service fields.
  5. In theLogging section, select theEnable logging checkbox.
  6. Set aSample rate fraction. You can set a rate to0.0 through1.0 (default).
  7. Optional: To include all the optional fields in the logs, in theOptional fields section, clickInclude all optional fields.

    Pro tip: To specify theCUSTOM option, use the gcloud CLI and the REST API.

  8. To finish editing the backend service, clickUpdate.
  9. To finish editing the load balancer, clickUpdate.

gcloud

Create the backend service to enable logging with thegcloud compute backend-services create command.

    gcloud compute backend-services createBACKEND_SERVICE \      --region=REGION \      --enable-logging \      --logging-sample-rate=SAMPLE_RATE \      --logging-optional=LOGGING_OPTIONAL \      --logging-optional-fields=OPTIONAL_FIELDS

Replace the following:

  • BACKEND_SERVICE: the name of the backend service.
  • REGION: the region of the backend service to create.
  • SAMPLE_RATE: this field can only be specified if logging is enabled for this backend service.

    The value of the field must be from0.0 to 1.0, where0.0 means that no logs are generated and1.0 means that logs are generated for all of thesampled packets. Enabling logging but setting the sampling rate to0.0 is equivalent to disabling logging. The default value is1.0.

  • LOGGING_OPTIONAL: the optional fields that you want to include in the logs:
    • INCLUDE_ALL_OPTIONAL to include all optional fields.
    • EXCLUDE_ALL_OPTIONAL (default) to exclude all optional fields.
    • CUSTOM to include a custom list of optional fields that you specify inOPTIONAL_FIELDS.
  • OPTIONAL_FIELDS: a comma-separated list of optional fields that you want to include in the logs.

    For example,serverInstance.vm,serverGkeDetails. Can only be set ifLOGGING_OPTIONAL is set toCUSTOM.

API

Make aPOST request to theregionBackendServices.insert method.

    POST https://compute.googleapis.com/compute/v1/projects/`PROJECT_ID`/regions/`REGION`/backendServices

Exclude all optional fields

    {    "name": "BACKEND_SERVICE",    "loadBalancingScheme": "EXTERNAL",    "logConfig": {       "enable": true,       "sampleRate":SAMPLE_RATE      }    }

Include all optional fields

    {    "name": "BACKEND_SERVICE",    "loadBalancingScheme": "EXTERNAL",    "logConfig": {       "enable": true,       "sampleRate":SAMPLE_RATE,       "optionalMode": "INCLUDE_ALL_OPTIONAL"      }    }

Include a custom list of optional fields

    {    "name": "BACKEND_SERVICE",    "loadBalancingScheme": "EXTERNAL",    "logConfig": {       "enable": true,       "sampleRate":SAMPLE_RATE,       "optionalMode": "CUSTOM",       "optionalFields": ["field1","field2",...]      }    }

Enable logging on an existing backend service

Console

  1. In the Google Cloud console, go to theLoad balancing page.

    Go to Load balancing

  2. Click the name of your load balancer.
  3. ClickEdit, and then clickBackend Configuration.
  4. Next to your backend service, clickEdit.
  5. In theLogging section, select theEnable logging checkbox.
  6. Set aSample rate fraction. You can set a rate to0.0 through1.0 (default).
  7. Optional: To include all the optional fields in the logs, in theOptional fields section, clickInclude all optional fields.

    Pro tip: To specify theCUSTOM option, use the gcloud CLI and the REST API.

  8. To finish editing the backend service, clickUpdate.
  9. To finish editing the load balancer, clickUpdate.

gcloud

Enable logging on an existing backend service with thegcloud compute backend-services update command.

    gcloud compute backend-services updateBACKEND_SERVICE \      --region=REGION \      --enable-logging \      --logging-sample-rate=SAMPLE_RATE \      --logging-optional=LOGGING_OPTIONAL \      --logging-optional-fields=OPTIONAL_FIELDS

Replace the following:

  • BACKEND_SERVICE: the name of the backend service.
  • REGION: the region of the backend service to create.
  • SAMPLE_RATE: this field can only be specified if logging is enabled for this backend service.

    The value of the field must be from0.0 to 1.0, where0.0 means that no logs are reported and1.0 means that logs are generated for all of thesampled packets. Enabling logging but setting the sampling rate to0.0 is equivalent to disabling logging. The default value is1.0.

  • LOGGING_OPTIONAL: the optional fields that you want to include in the logs:
    • INCLUDE_ALL_OPTIONAL to include all optional fields.
    • EXCLUDE_ALL_OPTIONAL (default) to exclude all optional fields.
    • CUSTOM to include a custom list of optional fields that you specify inOPTIONAL_FIELDS.
  • OPTIONAL_FIELDS: a comma-separated list of optional fields that you want to include in the logs.

    For example,serverInstance.vm,serverGkeDetails. Can only be set ifLOGGING_OPTIONAL is set toCUSTOM.

API

Make aPATCH request to theregionBackendServices/patch method.

      PATCH https://compute.googleapis.com/compute/v1/projects/`PROJECT_ID`/regions/`REGION`/backendServices/`BACKEND_SERVICE`

Exclude all optional fields

     "logConfig": {       "enable": true,       "sampleRate":SAMPLE_RATE,       "optionalMode": "EXCLUDE_ALL_OPTIONAL"      }

Include all optional fields

    {    "name": "BACKEND_SERVICE",    "loadBalancingScheme": "EXTERNAL",    "logConfig": {       "enable": true,       "sampleRate":SAMPLE_RATE,       "optionalMode": "INCLUDE_ALL_OPTIONAL"      }    }

Include a custom list of optional fields

    {    "name": "BACKEND_SERVICE",    "loadBalancingScheme": "EXTERNAL",    "logConfig": {       "enable": true,       "sampleRate":SAMPLE_RATE,       "optionalMode": "CUSTOM",       "optionalFields": ["field1","field2",...]      }    }

Disable logging on an existing backend service

Console

  1. In the Google Cloud console, go to theLoad balancing page.

    Go to Load balancing

  2. Click the name of your load balancer.

  3. ClickEdit, and then clickBackend Configuration.

  4. To disable logging entirely, in theLogging section, clear theEnable logging checkbox.

  5. If you leave logging enabled, you can set a differentSample ratefraction. You can set the rate to0.0 through1.0 (default).To only generate logs for 20% of thesampled packets, set thevalue to0.2.

  6. To finish editing the backend service, clickUpdate.

  7. To finish editing the load balancer, clickUpdate.

gcloud

Disable logging on the backend service with thegcloud compute backend-services update command.

gcloud compute backend-services updateBACKEND_SERVICE \  --region=REGION \  --no-enable-logging

Replace the following:

  • BACKEND_SERVICE: the name of the backend service.
  • REGION: the region of the backend service.

API

Make aPATCH request to theregionBackendServices/patch method.

 PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/backendServices/BACKEND_SERVICE

 { "logConfig": {   "enable": false  } }

View logs

When logs are ingested into Cloud Logging and not excluded through aLog router sink, you can read logs by using theCloud Logging API and theGoogle Cloud CLI.

To view all the external passthrough Network Load Balancer logs:

Console

  1. In the Google Cloud console, go to theLogs Explorer page.

    Go to Logs Explorer

  2. Select theExternal Passthrough Network Load Balancer Rule resource type.

  3. Select theloadbalancing.googleapis.com/flows log name.

Console query

  1. In the Google Cloud console, go to theLogs Explorer page.

    Go to Logs Explorer

  2. Click theShow query toggle.

  3. Paste the following into the query field. ReplacePROJECT_ID with your project ID.

    resource.type="loadbalancing.googleapis.com/ExternalNetworkLoadBalancerRule"logName="projects/PROJECT_ID/logs/loadbalancing.googleapis.com%2Fflows"
  4. ClickRun query.

View logs for a specific backend service

To view the external passthrough Network Load Balancer logs for a specific backend service:

Console query

  1. In the Google Cloud console, go to theLogs Explorer page.

    Go to Logs Explorer

  2. Click theShow query toggle.

  3. Paste the following into the query field. ReplacePROJECT_ID with your project ID andBACKEND_SERVICE_NAME with thename of your backend service.

    resource.type="loadbalancing.googleapis.com/ExternalNetworkLoadBalancerRule"logName="projects/PROJECT_ID/logs/loadbalancing.googleapis.com%2Fflows"resource.labels.backend_service_name="BACKEND_SERVICE_NAME"
  4. ClickRun query.

View logs for a backend instance group

To view the external passthrough Network Load Balancer logs for a specific backend instance group:

Console query

  1. In the Google Cloud console, go to theLogs Explorer page.

    Go to Logs Explorer

  2. Click theShow query toggle.

  3. Paste the following into the query field. ReplacePROJECT_ID with your project ID andBACKEND_GROUP_NAME with the name of the instance group.

    resource.type="loadbalancing.googleapis.com/ExternalNetworkLoadBalancerRule"logName="projects/PROJECT_ID/logs/loadbalancing.googleapis.com%2Fflows"resource.labels.backend_group_name="BACKEND_GROUP_NAME"
  4. ClickRun query.

Log fields

Log records contain required fields, which are the default fields of every logrecord, and optional fields that add additional information. Optional fields canbe omitted to save storage costs.

Some log fields are in a multi-field format, with more than one piece of datain a given field. For example, theconnection field is of theIpConnectionformat, which contains the source and destination IP address and port, plus theprotocol, in a single field. These multi-field fields are described in thefollowing record format table.

The monitored resource isloadbalancing.googleapis.com/ExternalNetworkLoadBalancerRule.

FieldField formatField type: Required or OptionalDescription
connectionIpConnectionRequired5-Tuple describing this connection.
startTimestringRequiredTimestamp (RFC 3339 date string format) of the first observed packet during theaggregated time interval.
endTimestringRequiredTimestamp (RFC 3339 date string format) of the last observed packet during theaggregated time interval.
bytesSentint64RequiredNumber of bytes sent from the server to the client.
bytesReceivedint64RequiredNumber of bytes received by the server from the client.
packetsSentint64RequiredNumber of packets sent from the server to the client.
packetsReceivedint64RequiredNumber of packets received by the server from the client.
rttstringRequired

Latency is measured only for TCP connections. Latency is the sum of estimatednetwork round-trip time (RTT) plus time consumed processing the packet withinthe client's operating system.

For sampled packets, the RTT is calculated from the perspective of a load-balanced backendby measuring time differences between the backend sending a TCPsegment and the backend receiving a TCP acknowledgment for the sequence numberof the sent segment.

Latency is formatted as a string that begins with the number ofseconds and ends with "s" to indicate seconds. Nanoseconds isexpressed as fractional seconds—for example, latency of 250 milliseconds isformatted as "0.250000000s".

serverInstanceInstanceDetailsOptionalThe backend VM instance details.
clientLocationGeographicDetailsOptionalThe available location metadata of the client.
serverGkeDetailsGkeDetailsOptionalGKE metadata for the server backend. Only available if thebackend is a GKE endpoint.
networkTierNetworkTierDetailsOptionalNetwork tier for external connections, filled only when the client is not withinGoogle Cloud.

IpConnection field format

FieldTypeDescription
clientIpstringClient IP address
clientPortint32Client port. Set for TCP and UDP connections only.
serverIpstringServer IP address (forwarding rule IP)
serverPortint32Server port. Set for TCP and UDP connections only.
protocolint32IANA protocol number

InstanceDetails field format

FieldTypeDescription
projectIdstringID of the project containing the VM
vmstringInstance name of the VM
regionstringRegion of the VM
zonestringZone of the VM
vmIpstringPrimary internal IPv4 address of the network interface that served the connection

GeographicDetails field format

FieldTypeDescription
continentstringContinent name
regionCodestringA Unicode CLDR region code such asUS orFR. For most countries, these codes correspond directly toISO-3166-2 codes.
subRegionstringA Unicode CLDR subdivision ID—for example, a province or state of the country such asUSCA orCAON. These Unicode codes are derived from the subdivisions defined by theISO-3166-2 standard.
citystringName of the city—for example,Mountain View for Mountain View, California. There is no canonical list of valid values for this variable. The city names can contain US-ASCII letters, numbers, spaces, and the following characters:!#$%&'*+-.^_`|~.
asnint32The autonomous system number (ASN) of the external network to which this endpoint belongs.

GkeDetails field format

FieldTypeDescription
clusterClusterDetailsGKE cluster metadata
podPodDetailsGKE Pod metadata, populated when the source or destination of the traffic is a Pod
serviceServiceDetailsGKE service metadata, populated in service endpoints only. The record contains up to two services. If there are more than two relevant services, this field contains a single service with a specialMANY_SERVICES marker.

ClusterDetails field format

FieldTypeDescription
clusterstringGKE cluster name
clusterLocationstringLocation of the cluster. The cluster location can be a zone or a region.

PodDetails field format

FieldTypeDescription
podstringName of the Pod
podNamespacestringNamespace of the Pod

ServiceDetails field format

FieldTypeDescription
servicestringName of the service. If there are more than two relevant services, the field is set to a specialMANY_SERVICES marker.
serviceNamespacestringNamespace of the service

NetworkTierDetails field format

FieldTypeDescription
networkTierstringNetworkTier used in the connection, one of [PREMIUM, STANDARD, FIXED_STANDARD, UNKNOWN].

Monitoring

External passthrough Network Load Balancers export key metrics toCloud Monitoring.

Monitoring metrics can be used for the following purposes:

  • Evaluate configuration, usage, and performance of a load balancer
  • Troubleshoot problems
  • Improve resource utilization and user experience

In addition to the predefined dashboards in Monitoring, you cancreate custom dashboards, set up alerts, and query the metrics through theMonitoring API.

View Monitoring dashboards

Console

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

    Go to Monitoring

  2. In the navigation pane, selectDashboards.

  3. Select theGoogle Cloud Load Balancers dashboard. All the load balancers aredisplayed.

  4. Select the load balancer name from the list of load balancers.

In theExternal passthrough Network Load Balancer details pane, you can see various details forthe selected load balancer. This pane displays your current configurations.

In theKey metrics pane, you can see charts for each key metric. To seespecific breakdowns, clickBreakdowns. This pane presents data informed byhistorical configurations, while theExternal passthrough Network Load Balancer details paneonly displays the current configurations.For more information, seeDashboards and charts.

Note: Monitoring collects external passthrough Network Load Balancer data every 15minutes. However, it might take up to two hours after you create your firstexternal passthrough Network Load Balancer for data to be available in Cloud Logging andMonitoring.

Define Monitoring custom dashboards

You can create custom Monitoring dashboards overexternal passthrough Network Load Balancer metrics.

Refer toMetrics and resource types for a list ofcollected metrics. Refer toFilters for lists of attributes you canuse to filter your results.

Console

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

    Go to Monitoring

  2. SelectDashboards> Create Dashboard.

  3. ClickAdd chart.

  4. Give the chart a title.

  5. Select metrics and filters.

    To find external passthrough Network Load Balancer metrics, search for theloadbalancing.googleapis.com/l3/external prefix.

  6. ClickSave.

Define Monitoring alerts

You can defineMonitoring alerts overvarious external passthrough Network Load Balancer metrics:

Console

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

    Go to Monitoring

  2. SelectAlerting> Create a Policy.

  3. Select resource types and metrics.

    To find external passthrough Network Load Balancer resource types and metrics, searchforloadbalancing.googleapis.com/l3/external in theFind resource type and metric field.

  4. Specify aConfiguration to set when an alert should be triggered.

  5. AddFilters if needed.

  6. ClickSave.

Metric reporting frequency and retention

Metrics for the external passthrough Network Load Balancers are exported to Monitoring inone-minute granularity batches. Monitoring data is retained for six weeks.Metrics are based on sampled traffic (sampling rate is dynamic and cannot beadjusted).The dashboard provides data analysis in default intervals of one hour (1H), sixhours (6H), one day (1D), one week (1W), and six weeks (6W). You can manuallyrequest analysis in any interval from six weeks to sixty seconds.

Metrics and resource types

This section describes the metrics and resource types for external passthrough Network Load Balancers.

Metrics

The following metrics for external passthrough Network Load Balancers arereported into Monitoring. You can usethese metric names when makingAPI requests.

metric_nameTypeDescription
loadbalancing.googleapis.com/l3/external/ingress_bytes_countcounterThe number of bytes sent from a client to an external passthrough Network Load Balancer backend. For TCP flows, only bytes in the application stream are counted.
loadbalancing.googleapis.com/l3/external/ingress_packets_countcounterThe number of packets sent from a client to an external passthrough Network Load Balancer backend.
loadbalancing.googleapis.com/l3/external/egress_bytes_countcounterThe number of bytes sent from an external passthrough Network Load Balancer backend to a client. For TCP flows, only bytes in the application stream are counted.
loadbalancing.googleapis.com/l3/external/egress_packets_countcounterThe number of packets sent from an external passthrough Network Load Balancer backend to a client.
loadbalancing.googleapis.com/l3/external/rtt_latenciesdistribution

A distribution of rtt measured over TCP connections for external passthrough Network Load Balancer flows.

Available only for TCP traffic.

Resource types

External passthrough Network Load Balancers use the following resource types:

  • tcp_lb_rule
  • udp_lb_rule
  • loadbalancing.googleapis.com/ExternalNetworkLoadBalancerRule

An external passthrough Network Load Balancer can support TCP, UDP, ESP, GRE, ICMP, and ICMPv6 traffic.

You can specify the resource type astcp_lb_rule orudp_lb_rule to limitmonitored data to either TCP or UDP protocols.You can specify the resource type asloadbalancing.googleapis.com/ExternalNetworkLoadBalancerRuleto monitor all the supported protocols including TCP, UDP, ESP, GRE, ICMP, and ICMPv6protocols.

Filters

Metrics are aggregated for each external passthrough Network Load Balancer. You can filter aggregatedmetrics by the following dimensions.

Resource labels fortcp_lb_rule orudp_lb_rule

You can restrict your query by resource. You can also group results by thesevalues.

resource.label.<var>LABEL_KEY</var>:
label_keyTypeDescription
projectstringThe identifier of the Google Cloud project associated with this resource.
load_balancer_namestringThe name of the load balancer.
regionstringTheregion where the load balancer's backend is located—for example,us-central1,europe-west1,asia-east1.
network_namestringThe VPC network in which the load balancer backend resides.
backend_target_typestringIndicates whether the external passthrough Network Load Balancer is target pool-based or backend service-based. Valid values areBACKEND_SERVICE orTARGET_POOL.
backend_target_namestringFor target pool-based external passthrough Network Load Balancers, the name of the target pool. For backend service-based external passthrough Network Load Balancers, the name of the backend service.
forwarding_rule_namestringThe name of the forwarding rule.
forwarding_rule_network_tierstringThenetwork tier of the forwarding rule.
backend_namestring

The name of the backend that handled the connection.

For a backend service-based external passthrough Network Load Balancer, the value is the name of the backend instance group or network endpoint group (NEG) that handled the connection.

For a target pool-based external passthrough Network Load Balancer, the value is the name of the target pool.

backend_typestring

The type of backend that handled the connection.

For a backend service-based external passthrough Network Load Balancer, the value can be eitherINSTANCE_GROUP orNETWORK_ENDPOINT_GROUP.

For a target pool-based external passthrough Network Load Balancer, the value isTARGET_POOL.

backend_scopestring

For a backend service-based external passthrough Network Load Balancer, the zone or region of the backend instance group or NEG.

For a target pool-based network load balancer, the value isUNSUPPORTED_FOR_TARGET_POOL.

backend_scope_typestring

The type of scope of the backend group that handled the connection. Valid values areZONE orREGION.

For a target pool-based network load balancer, the value isUNSUPPORTED_FOR_TARGET_POOL.

backend_failover_configurationstringThe failover configuration of the backend group that handled the connection. Valid values arePRIMARY,BACKUP, orUNKNOWN.
backend_subnetwork_namestringThe name of the subnetwork of the backend that received the connection.
endpoint_zonestringThe zone of the backend VM that handled the connection.

Resource labels forloadbalancing.googleapis.com/ExternalNetworkLoadBalancerRule

You can restrict your query by resource. You can also group results by thesevalues.

resource.label.<var>LABEL_KEY</var>:
label_keyTypeDescription
projectstringThe identifier of the Google Cloud project associated with this resource.
regionstringTheregion where the load balancer's backend is located—for example,us-central1,europe-west1,asia-east1.
backend_network_namestringThe VPC network in which the load balancer backend resides.
backend_target_typestringThe type of backend target that handled the connection. Valid values areBACKEND_SERVICE orTARGET_POOL.
backend_service_namestringThe name of the backend service that handled the connection. If thebackend_target_type isTARGET_POOL, then the value isUNSUPPORTED_FOR_TARGET_POOL.
primary_target_poolstringThe name of the primary target pool. If thebackend_target_type isBACKEND_SERVICE, then the value isUNSUPPORTED_FOR_BACKEND_SERVICE.
target_poolstringThe name of the target pool. If thebackend_target_type isBACKEND_SERVICE, then the value isUNSUPPORTED_FOR_BACKEND_SERVICE.
forwarding_rule_namestringThe name of the external passthrough Network Load Balancer's forwarding rule.
backend_group_namestringThe name of the backend group that handled the connection. If thebackend_target_type isTARGET_POOL, then the value isUNSUPPORTED_FOR_TARGET_POOL.
backend_group_typestring

The type of backend group that handled the connection.

If thebackend_target_type isBACKEND_SERVICE, then the value is eitherINSTANCE_GROUP orNETWORK_ENDPOINT_GROUP.

If thebackend_target_type isTARGET_POOL, then the value isUNSUPPORTED_FOR_TARGET_POOL.

backend_group_scopestringThe scope of the backend group (name of the zone or region) that handled the connection. If thebackend_target_type isTARGET_POOL, then the value isUNSUPPORTED_FOR_TARGET_POOL.
backend_subnetwork_namestringThe name of the subnetwork of the backend that received the connection.
backend_zonestringThe zone of the backend VM that handled the connection.

Metric labels

You can restrict your query by metric label. You can also group results by thesevalues.

metric.label.<var>LABEL_KEY</var>:
label_keyTypeDescription
client_countrystringThe country of the client that initiated the connection to the external passthrough Network Load Balancer.
client_continentstringThe continent of the client that initiated the connection to the external passthrough Network Load Balancer.
protocolstring

The protocol in the connection for theloadbalancing.googleapis.com/ExternalNetworkLoadBalancerRule resource.

This field is left blank for thetcp_lb_rule andudp_lb_rule resources.

Monitoring API requests

You can construct arbitrary queries over external passthrough Network Load Balancer metricsby using theMonitoring API`s v3 projects.timeSeries.list request.The exact structure of the various definitions follows the genericmonitoring filters semantics.

Example API requests

  • Get all bytes sent from all external passthrough Network Load Balancers in the project during 12:00-12:02 PM UTC on 2019-07-01with 1m aggregates.

    timeSeries.list parameters:

    • name: projects/PROJECT_ID
    • Filter:resource.type = "tcp_lb_rule" ANDmetric.name="loadbalancing.googleapis.com/l3/external/egress_bytes_count"
    • interval.start_time:2019-07-01T12:00:00Z
    • interval.end_time:2019-07-01T12:02:00Z
    • aggregation.alignmentPeriod:60s
    • aggregation.crossSeriesReducer:REDUCE_SUM
    • aggregation.perSeriesAligner:ALIGN_SUM
  • Get median RTT measurement over all external passthrough Network Load Balancers in theproject during 12:19-12:20 PM UTC on 2019-07-01, broken down by client country.

    timeSeries.list parameters:

    • name: projects/PROJECT_ID
    • Filter:resource.type = "tcp_lb_rule" ANDmetric.name="loadbalancing.googleapis.com/l3/external/rtt_latencies"
    • interval.start_time:2019-07-01T12:19:00Z
    • interval.end_time:2019-07-01T12:20:00Z
    • aggregation.alignmentPeriod:60s
    • aggregation.crossSeriesReducer:REDUCE_SUM
    • aggregation.groupByFields:metric.label.client_country
    • aggregation.perSeriesAligner:ALIGN_PERCENTILE_50
  • Get total bytes from a specific external passthrough Network Load Balancer during12:19-12:20 PM UTC on 2019-07-01, broken down by endpoint zone and client continent.

    timeSeries.list parameters:

    • name: projects/PROJECT_ID
    • Filter:resource.type = "tcp_lb_rule" ANDresource.label.load_balancer_name = "netlb-bs-1" ANDmetric.name="loadbalancing.googleapis.com/l3/external/ingress_bytes_count"
    • interval.start_time:2019-07-01T12:19:00Z
    • interval.end_time:2017-07-01T12:20:00Z
    • aggregation.alignmentPeriod:60s
    • aggregation.crossSeriesReducer:REDUCE_SUM
    • aggregation.groupByFields:metric.label.client_continent
    • aggregation.groupByFields:resource.label.endpoint_zone
    • aggregation.perSeriesAligner:ALIGN_SUM

What's next

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 2025-12-15 UTC.