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

Monitor WebSocket Connections on GCP External Application Load Balancer

Hi GCP Community,

I am using an External Application Load Balancer in GCP to handle WebSocket traffic for my application with backend service configured on an internet NEG

Question: I want to monitor and analyze the WebSocket traffic flowing through the load balancer. Specifically:

 

  • Metrics: Are there any built-in metrics or logging options for WebSocket-specific traffic (e.g., connection count, duration, errors, etc.)?
  • Logs: Does GCP provide detailed logging for WebSocket connections, or do I need to enable additional logging in the load balancer settings?
  • Third-party Tools: Would integrating a third-party monitoring solution be more effective for WebSocket traffic, and if so, what are some recommended tools?
  • Best Practices: Any best practices for setting up monitoring for WebSocket connections in this setup?

 

0 2 431
2 REPLIES 2

Hi @wajahat86,

Welcome to Google Cloud Community!

You may check Global external Application Load Balancer logging and monitoring, this explains how you can enable, disable, and view logs for an external Application Load Balancer backend service, and it is indicated that for monitoring websocket connections, you have to create a backend service specifically for websockets. 

You'll need to configure your backend services to generate more comprehensive access logs. Then, you can use Cloud Logging to collect and analyze these logs. Send your application logs to Cloud Logging for centralized management, analysis, and alerting.

Other relevant references:

WebSocket support

Cloud Monitoring

I hope the information above is helpful.

Hi @diannemcm thanks for your reply, actually the backend service is an internet NEG and not under our control. It is managed by a third party. Therefore we are interested to monitor the websockets through our GCP Application Load Balancer that we own and manage. The metrics already available are not specific to websockets and the logging only captures the initial http request from client to upgrade the connection. The actual websocket communication is not logged.