Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Enable Logs in GCP backend target-pool

I have a External Network (Passthrough target-pool) Load Balancer where I want to enable Logging at Load Balancer level, but can't find the option using either console or gcloud command.

What is the difference between Backend service and Target pool in Backend type?

Is this even possible to enable logging with Target-pool network load balancer?

Solved Solved
3 2 1,497
1 ACCEPTED SOLUTION

Hi @nikhildobriyal,

Welcome to the Google Cloud Community!

What is the difference between Backend service and Target pool in Backend type?

Backend service-based load balancers: External passthrough Network Load Balancers can be created with a regional backend service that defines the behavior of the load balancer and how it distributes traffic to its backend instance groups. Backend services enable features that are not supported with legacy target pools, such as support for non-legacy health checks (TCP, SSL, HTTP, HTTPS, or HTTP/2), auto-scaling with managed instance groups, connection draining, and a configurable failover policy.

Backend service-based load balancers support IPv4 and IPv6 traffic. They can load-balance TCP, UDP, ESP, GRE, ICMP, and ICMPv6 traffic. You can also use source IP-based traffic steering to direct traffic to specific backends. Load balancing to Google Kubernetes Engine (GKE) is handled by using the built-in GKE Service controller. In addition, backend service-based external passthrough Network Load Balancers are supported with App Hub, which is in preview[1].

Target pool-based load balancers: A target pool is the legacy backend supported with external passthrough Network Load Balancers. A target pool defines a group of instances that should receive incoming traffic from the load balancer.

Target pool-based load balancers support either TCP or UDP traffic. Forwarding rules for target pool-based external passthrough Network Load Balancers only support external IPv4 addresses[2].

Is this even possible to enable logging with Target-pool network load balancer?

Currently, logging for backend services is supported. You may refer to this documentation for more information - Enable logging on a new backend service.

Additionally, you may refer to the documentations below for more information:

[1]. https://cloud.google.com/load-balancing/docs/passthrough-network-load-balancer#backend_service-based...

[2]. https://cloud.google.com/load-balancing/docs/network/networklb-target-pools#target_pools

View solution in original post

2 REPLIES 2

Hi @nikhildobriyal,

Welcome to the Google Cloud Community!

What is the difference between Backend service and Target pool in Backend type?

Backend service-based load balancers: External passthrough Network Load Balancers can be created with a regional backend service that defines the behavior of the load balancer and how it distributes traffic to its backend instance groups. Backend services enable features that are not supported with legacy target pools, such as support for non-legacy health checks (TCP, SSL, HTTP, HTTPS, or HTTP/2), auto-scaling with managed instance groups, connection draining, and a configurable failover policy.

Backend service-based load balancers support IPv4 and IPv6 traffic. They can load-balance TCP, UDP, ESP, GRE, ICMP, and ICMPv6 traffic. You can also use source IP-based traffic steering to direct traffic to specific backends. Load balancing to Google Kubernetes Engine (GKE) is handled by using the built-in GKE Service controller. In addition, backend service-based external passthrough Network Load Balancers are supported with App Hub, which is in preview[1].

Target pool-based load balancers: A target pool is the legacy backend supported with external passthrough Network Load Balancers. A target pool defines a group of instances that should receive incoming traffic from the load balancer.

Target pool-based load balancers support either TCP or UDP traffic. Forwarding rules for target pool-based external passthrough Network Load Balancers only support external IPv4 addresses[2].

Is this even possible to enable logging with Target-pool network load balancer?

Currently, logging for backend services is supported. You may refer to this documentation for more information - Enable logging on a new backend service.

Additionally, you may refer to the documentations below for more information:

[1]. https://cloud.google.com/load-balancing/docs/passthrough-network-load-balancer#backend_service-based...

[2]. https://cloud.google.com/load-balancing/docs/network/networklb-target-pools#target_pools

Hi this is helpful, as a follow up to this. Is there a way to enable logging if the external pass through load balancer is part of a GKE Autopilot deployment?

Is there some annotation that we can pass like this:

apiVersion: v1
kind: Service
metadata:
name: network1
cloud.google.com/load-balancer-logging: '{"enable": true}' add this annotation
spec:
type: LoadBalancer
externalTrafficPolicy: Local
selector:
app: network
ports:
- name: http1
protocol: TCP
port: 443
targetPort: 8081