> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Monitoring for load balancers

Load Balancers expose metrics and access logs through two mechanisms: a Prometheus listener that publishes a scrape endpoint, and Managed Logging that forwards listener access logs to OpenSearch. Both are configured per Load Balancer in the Customer Portal.

## Prometheus listener

A Prometheus listener exposes an endpoint with the Load Balancer's metrics for scraping with Prometheus and viewing with Grafana. Unlike regular balancing listeners, it does not route traffic — it only serves metrics.

<Tip>
  Import [this pre-made Grafana dashboard](https://grafana.com/grafana/dashboards/15828-openstack-octavia-amphora-load-balancer/) to display the metrics.
</Tip>

### Enable Prometheus listener

<Steps>
  <Step title="Open the Load Balancer settings">
    In the **Cloud** menu, select **Networking** and then **Load Balancers**. Click the Load Balancer name to open its settings.

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-lb-list.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=ffc90b11e5ec7f183ad9b398f7ac3f44" alt="Load Balancers list with two load balancers in Luxembourg-3 region" width="1089" height="534" data-path="images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-lb-list.png" />
    </Frame>
  </Step>

  <Step title="Open the Listeners tab">
    Select the **Listeners** tab and click **Add Listener**.

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-listeners-tab.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=a82d858c151df70944e5f5770d30972b" alt="Listeners tab showing Add Listener button in the top right corner" width="1087" height="516" data-path="images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-listeners-tab.png" />
    </Frame>
  </Step>

  <Step title="Configure the listener">
    Enter a **Name**, select **Prometheus** as the **Protocol**. The default port is `9101`. Set a **Connection limit** if needed.

    The following options are available to secure the Prometheus listener:

    * Define an allowed IP range with **Allowed CIDRs**.
    * Define a list of users with access through **User List** (Basic Auth).
    * Enable SSL/TLS by [adding certificates](/cloud/networking/load-balancers/add-certificates-to-load-balancer).
    * Enable mTLS [via the Gcore Cloud API](/cloud/networking/load-balancers/configure-mtls-authentication).

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-add-listener-prometheus.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=c3bfd7da00cb43cab8dc607aad10c264" alt="Add Listener dialog with Prometheus protocol selected, showing Port 9101 and security options" width="1400" height="900" data-path="images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-add-listener-prometheus.png" />
    </Frame>
  </Step>

  <Step title="Create the listener">
    Click **Create Listener** and wait until the Prometheus listener appears in the list.

    Add the listener as a target to a Prometheus instance by adding the following lines to `prometheus.yml` under `scrape_configs`:

    ```yaml theme={null}
    - job_name: <LOAD_BALANCER_NAME>
      metrics_path: /metrics
      static_configs:
        - targets:
            - <LOAD_BALANCER_IP>:<PROMETHEUS_LISTENER_PORT>
    ```
  </Step>
</Steps>

### Disable Prometheus listener

<Info>
  Before deleting a Prometheus listener, delete the corresponding job from all `prometheus.yml` files.
</Info>

<Steps>
  <Step title="Open the Load Balancer settings">
    In the **Cloud** menu, select **Networking** and then **Load Balancers**. Click the Load Balancer name.
  </Step>

  <Step title="Delete the listener">
    Select the **Listeners** tab, find the Prometheus listener, click the action menu on the right, and click **Delete**.
  </Step>
</Steps>

## Logging as a service

Load Balancers can forward listener access logs to Gcore Managed Logging (LaaS). Logs are stored in the destination region configured per Load Balancer.

### Enable logging

<Steps>
  <Step title="Open the Load Balancer settings">
    In the **Cloud** menu, select **Networking** and then **Load Balancers**. Click the Load Balancer name.
  </Step>

  <Step title="Configure logging">
    Select the **Logging** tab and activate the **Enable Logging** toggle.

    Select a **Destination region**, then select an existing log **Topic** or create a new one and specify the **Retention** period. For full configuration details, see [Logging for load balancers](/cloud/networking/load-balancers/logging-for-load-balancers).

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-logging-form.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=8c5d9236a04084dd17860a30a4e647da" alt="Logging tab with Enable Logging toggle on, showing destination region and topic configuration fields" width="1400" height="900" data-path="images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-logging-form.png" />
    </Frame>
  </Step>

  <Step title="Save">
    Click **Save changes**. The Logging service begins collecting logs for the Load Balancer.
  </Step>
</Steps>

### View the logs

Logs are accessible in the Customer Portal or in [a Grafana instance](/cloud/logging-as-a-service/view-opensearch-logs-in-Grafana).

<Steps>
  <Step title="Open Managed Logging">
    In the **Cloud** menu, select **Managed Logging**.

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-managed-logging.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=51d5d5d45137356426345689cc6713ca" alt="Managed Logging page in Cloud section" width="1400" height="900" data-path="images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-managed-logging.png" />
    </Frame>
  </Step>

  <Step title="Open the OpenSearch dashboard">
    Select a log topic from the list and click the corresponding **View Logs** link.
  </Step>
</Steps>

### Disable logging

<Steps>
  <Step title="Open the Load Balancer settings">
    In the **Cloud** menu, select **Networking** and then **Load Balancers**. Click the Load Balancer name.
  </Step>

  <Step title="Deactivate logging">
    Select the **Logging** tab, deactivate the **Enable Logging** toggle, and click **Save changes**.

    <Frame>
      <img src="https://mintcdn.com/gcore/yrEa6OGy4Q_zWlXb/images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-logging-disabled.png?fit=max&auto=format&n=yrEa6OGy4Q_zWlXb&q=85&s=04c28c74be4b597dada2ad62183a1061" alt="Logging tab with Enable Logging toggle off and Save changes button" width="1087" height="549" data-path="images/docs/cloud/networking/load-balancers/monitoring-for-load-balancers/monitoring-logging-disabled.png" />
    </Frame>
  </Step>
</Steps>

## Cloud API endpoints

Status, metrics, and general statistics for Load Balancers are available via the Gcore Cloud API.

### Load Balancer status

The status endpoints return the operating and provisioning status of a Load Balancer, its listeners, and their pools. Request [one Load Balancer's status](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerStatusInstanceViewSet.get) or [status for all Load Balancers](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerStatusViewSet.get).

### Load Balancer metrics

The [metrics endpoint](/api-reference/cloud#tag/Load-Balancers/operation/LoadbalancerMetricsHandler.post) returns CPU, memory, and network utilization data for the Load Balancer.

### Load Balancer and listener statistics

Request statistics by calling the GET endpoint with `?show_stats=true`: [one Load Balancer](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerInstanceViewSet.get), [one listener](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerListenerInstanceViewSet.get), or [all listeners](/api-reference/cloud#tag/Load-Balancers/operation/LoadBalancerListenerViewSet.get).
