[Yandex Cloud documentation](../../index.md) > [Yandex Application Load Balancer](../index.md) > [Tutorials](index.md) > Writing load balancer logs to PostgreSQL

# Writing load balancer logs to PostgreSQL


You can write load balancer [logs](../concepts/monitoring.md#logging) (messages about each incoming request to a Yandex Application Load Balancer) to a PostgreSQL database.

To log load balancer operations, a [log group](../../logging/concepts/log-group.md) will be created in Cloud Logging. Log delivery from this group to the database will be set up using Yandex Cloud Functions resources: a [trigger](../../functions/concepts/trigger/cloud-logging-trigger.md) and a triggered [function](../../functions/concepts/function.md).

To create a database, we will use [Yandex Managed Service for PostgreSQL](../../managed-postgresql/index.md).

To set up logging:

1. [Get your cloud ready](#before-begin).
1. [Create a cloud network](#create-network).
1. [Create a service account](#create-sa).
1. [Create security groups](#create-security-groups).
1. [Set up a database in Yandex Managed Service for PostgreSQL](#set-up-db).
1. [Create an instance group](#create-vms).
1. [Create a Yandex Cloud Logging log group](#create-log-group).
1. [Create the required resources in Yandex Application Load Balancer](#create-alb-resources).
1. [Create the required resources in Yandex Cloud Functions](#set-up-sf).
1. [Test the logging process](#test).

If you no longer need the resources you created, [delete them](#clear-out).

## Get your cloud ready {#before-begin}

Sign up for Yandex Cloud and create a [billing account](../../billing/concepts/billing-account.md):
1. Navigate to the [management console](https://console.yandex.cloud) and log in to Yandex Cloud or create a new account.
1. On the **[Yandex Cloud Billing](https://center.yandex.cloud/billing/accounts)** page, make sure you have a billing account linked and it has the `ACTIVE` or `TRIAL_ACTIVE` [status](../../billing/concepts/billing-account-statuses.md). If you do not have a billing account, [create one](../../billing/quickstart/index.md) and [link](../../billing/operations/pin-cloud.md) a cloud to it.

If you have an active billing account, you can create or select a [folder](../../resource-manager/concepts/resources-hierarchy.md#folder) for your infrastructure on the [cloud page](https://console.yandex.cloud/cloud).

[Learn more about clouds and folders here](../../resource-manager/concepts/resources-hierarchy.md).


### Required paid resources {#paid-resources}

* VMs: use of computing resources, storage, public IP address, and the OS (see [Compute Cloud pricing](../../compute/pricing.md)).
* Managed Service for PostgreSQL cluster: computing resources allocated to hosts, storage and backup size (see [Managed Service for PostgreSQL pricing](../../managed-postgresql/pricing.md)).
* Yandex Cloud Functions functions: number of function calls, idle time of provisioned instances, and computing resources allocated for the function (see [Yandex Cloud Functions pricing](../../functions/pricing.md)).
* Cloud Logging logs: amount of data written and its retention period (see [Cloud Logging pricing](../../logging/pricing.md)).
* Application Load Balancer instances: use of computing resources of each active load balancer (see [Application Load Balancer pricing](../pricing.md)).


## Create a cloud network {#create-network}

All resources you create will belong to the same [cloud network](../../vpc/concepts/network.md).

To create a network:

{% list tabs group=instructions %}

- Management console {#console}

    1. Open the [management console](https://console.yandex.cloud).
    1. Navigate to **Virtual Private Cloud**.
    1. Click **Create network**.
    1. Specify the network **Name**: `alb-logging-network`.
    1. In the **Advanced** field, select **Create subnets**.
    1. Click **Create network**.
    
{% endlist %}

## Create a service account {#create-sa}

{% list tabs group=instructions %}

- Management console {#console}
  
  1. In the [management console](https://console.yandex.cloud), select the relevant folder.
  1. Navigate to **Identity and Access Management**.
  1. Click **Create service account**.
  1. In the **Name** field, enter `alb-logging-service-account`.
  1. Add the `functions.functionInvoker` and `editor` roles.
  1. Click **Create**.

{% endlist %}

## Create security groups {#create-security-groups}

[Security groups](../concepts/application-load-balancer.md#security-groups) include rules that: 
* Allow the load balancer to receive incoming traffic and forward it to the VMs so they can receive the traffic. 
* Allow the load balancer to send logs to the log group and the PostgreSQL cluster, to receive the logs from it.

You will create three security groups: one for the load balancer, another one for all VMs, and the third one for the cluster.

To create security groups:

{% list tabs group=instructions %}

- Management console {#console}

  1. Open the [management console](https://console.yandex.cloud).
  1. Navigate to **Virtual Private Cloud**.
  1. Open the **Security groups** tab.
  1. Create a security group for the load balancer:
     
     1. Click **Create security group**.
     1. Specify the group **Name**: `alb-logging-sg-balancer`.
     1. Select the **Network**: `alb-logging-network`.
     1. Under **Rules**, create the following rules using the instructions below the table:

        | Traffic<br/>direction | Description | Port range | Protocol | Source /<br/>destination | CIDR blocks |
        | --- | --- | --- | --- | --- | --- |
        | `Egress` | `any` | `All` | `Any` | `CIDR` | `0.0.0.0/0` |
        | `Ingress` | `ext-http` | `80` | `TCP` | `CIDR` | `0.0.0.0/0` |
        | `Inbound` | `ext-https` | `443` | `TCP` | `CIDR` | `0.0.0.0/0` |
        | `Inbound` | `healthchecks` | `30080` | `TCP` | `Load balancer healthchecks` | — |
      
        1. Select the **Egress** or **Ingress** tab.
        1. Click **Add**.
        1. In the **Port range** field of the window that opens, specify a single port or a range of ports open for inbound or outbound traffic.
        1. In the **Protocol** field, specify the appropriate protocol or leave `Any` to allow traffic transmission over any protocol.
        1. In the **Destination name** or **Source** field, select the rule purpose:
      
           * `CIDR`: Rule will apply to the range of IP addresses. In the **CIDR blocks** field, specify the CIDRs and masks of subnets traffic will move to/from. To add multiple CIDRs, click **Add**.
           * `Security group`: Rule will apply to the current or selected security group VMs.
           * `Load balancer healthchecks`: Rule allowing a load balancer to health-check VMs.

        1. Click **Save**. Repeat these steps to create all rules from the table.
   
     1. Click **Save**.

  1. Similarly, create a security group for the VM named `alb-logging-sg-vms` with the same `alb-logging-network` and the following rules:
      
     | Traffic<br/>direction | Description | Port range | Protocol | Source /<br/>destination | CIDR blocks |
     | --- | --- | --- | --- | --- | --- |
     | `Ingress` | `balancer` | `80` | `TCP` | `Security group` | `alb-logging-sg-balancer` |
     | `Ingress` | `ssh` | `22` | `TCP` | `CIDR` | `0.0.0.0/0` |
     
  1. Similarly, create a security group for the PostgreSQL cluster named `alb-logging-sg-cluster` with the same `alb-logging-network` and the following rules:
        
       | Traffic<br/>direction | Description | Port range | Protocol | Source /<br/>destination | CIDR blocks |
       | --- | --- | --- | --- | --- | --- |
       | `Ingress` | `db` | `6432` | `TCP` | `CIDR` | `0.0.0.0/0` |
     
{% endlist %}

## Set up a database in Yandex Managed Service for PostgreSQL {#set-up-db}

### Create a cluster {#set-up-db-create-cluster}

Logs received from the load balancer will be written to the database that is part of the Managed Service for PostgreSQL [cluster](../../managed-postgresql/concepts/index.md).

To create a cluster and a database:

{% list tabs group=instructions %}

- Management console {#console}

  1. Open the [management console](https://console.yandex.cloud).
  1. Navigate to **Managed Service for&nbsp;PostgreSQL**.
  1. Click **Create cluster**.
  1. In the **Cluster name** field, enter `alb-logging-cluster`.
  1. In the **Environment** field, select `PRODUCTION`.
  1. In the **Version** field, select `17`.
  1. Under **Host class**:

     * Specify the `Intel Cascade Lake` platform.
     * Select the `burstable` type.
     * Specify the `b2.medium` class.

     {% note warning %}

     The `b2.medium` class was selected for testing only. In real projects, we do not recommend using hosts with a guaranteed vCPU share less than 100%.

     {% endnote %}

  1. Under **Storage size**:

     * Select `network-ssd`.
     * Set the size to 10 GB.

     {% note info %}

     Select the type and size of the disk to fit your purpose. The above values are used for testing.

     {% endnote %}

  1. Under **Database**, specify the DB attributes:

     * Database name. It must be unique within the folder and contain only Latin letters, numbers, and underscores.
     * DB owner username. It may only contain Latin letters, numbers, and underscores.
     * User password. It must be from 8 to 128 characters long.

     For the database created with the cluster, the character set and collate settings are specified as `LC_CTYPE=C` and `LC_COLLATE=C`. You cannot change these settings after the database is created, but you can [create a new database](../../managed-postgresql/operations/databases.md#add-db) with the appropriate settings.

  1. Under **Network settings**:

     * Select `alb-logging-network`.
     * Select the `alb-logging-sg-cluster` security group.
   
  1. Under **Hosts**, add a host to be accessible from outside Yandex Cloud. To do this, enable **Public access**.
  1. Under **Advanced settings**, enable **Access from the management console** and **Serverless access**.
  1. Leave the default values in all other fields.
  1. Click **Create cluster**.

{% endlist %}

For more information about creating a cluster, see [How to create a PostgreSQL cluster](../../managed-postgresql/operations/cluster-create.md#create-cluster).

Afterwards, the cluster settings can be [updated](../../managed-postgresql/operations/update.md).

### Connect to the cluster and create a table {#set-up-db-create-table}

In this example, we will save data from the following message fields, which are logged by the load balancer when it receives requests, to the PostgreSQL database:

* `type`: Request protocol, HTTP or gRPC.
* `time`: Date and time of the request.
* `http_status`: HTTP code of the load balancer's response to the request.
* `backend_ip`: IP address of the VM that processed the request.
* `request_processing_times.request_time`: Duration of the connection between the client and the load balancer.

You need to create a log table in advance:

{% list tabs group=instructions %}

- Management console {#console}

  After [creating the cluster](#set-up-db-create-cluster), you will be automatically redirected to the **Clusters** page.

  1. Wait until `alb-logging-cluster` changes its status to **Alive**, then select this cluster.
  1. Navigate to the **SQL** tab.
  1. Select the user that you [created together with the cluster](#set-up-db-create-cluster) and enter their password.
  1. Select the database that you created together with the cluster, and click **Connect**.
  1. In the edit window, enter the following request:
  
     ```sql
     CREATE TABLE load_balancer_requests (
         type            varchar(24) NOT NULL,
         "time"          timestamptz NOT NULL,
         http_status     varchar(4) NOT NULL,
         backend_ip      varchar(40) NULL,
         request_time    numeric NULL
     );
     ```

  1. Click **Execute**.
  1. Wait until a message confirms that the request is complete.
  
{% endlist %}
    
## Create an instance group {#create-vms}

We will use a Compute Cloud [instance group](../../compute/concepts/instance-groups/index.md) as web servers for your website. The LEMP stack (Linux, NGINX, MySQL, PHP) will be installed on the servers. For more information, see [LAMP or LEMP-based website](../../tutorials/web/lamp-lemp/index.md).

To create an instance group:

{% list tabs group=instructions %}

- Management console {#console}

  1. Open the [management console](https://console.yandex.cloud).
  1. Navigate to **Compute Cloud**.
  1. Open the **Instance groups** tab. Click **Create group of virtual machines**.
  1. Enter the instance group name: `alb-logging-ig`.
  1. In the **Service account** field, select the account you [previously created](#create-sa).
  1. Under **Allocation**, select multiple [availability zones](../../overview/concepts/geo-scope.md) to ensure the fault tolerance of your hosting.
  1. Under **Instance template**, click **Define**.
  1. Under **Boot disk image**, open the **Marketplace** tab and click **Show all Marketplace products**. Select [LEMP](https://yandex.cloud/en/marketplace/products/yc/lemp) and click **Use**.
  1. Under **Computing resources**:
     
     - Select the VM [platform](../../compute/concepts/vm-platforms.md).
     - Specify the required number of vCPUs and the amount of RAM.
  
     This minimum configuration will do for functional website testing:
     * **Platform**: `Intel Cascade Lake`
     * **Guaranteed vCPU performance**: `5%`
     * **vCPU**: `2`
     * **RAM**: `1 GB`
  
  1. Under **Network settings**, select the **Network** named `alb-logging-network` that you [created earlier](#create-network) and its subnets.
  1. In the **Public address** field, select **Auto**. 
  1. Select the `alb-logging-sg-vms` security group [created earlier](#create-security-groups).
  1. Specify the VM access credentials:
     - In the **Login** field, enter the username.
     - In the **SSH key** field, paste the contents of the public key file.
        
       You need to create a key pair for the SSH connection yourself. See [Connecting to a VM via SSH](../../compute/operations/vm-connect/ssh.md).
        
     {% note alert %}
      
     Once created, the VM gets an IP address and a host name (FQDN) for connections. If you selected **No address** in the **Public address** field, you will not be able to access the VM from the internet.
      
     {% endnote %}
     
  1. Click **Save**.
  1. Under **Scaling**, enter the **Size** of the instance group: 2.
  1. Under **Integration with Application Load Balancer**, select **Create target group** and enter `alb-logging-tg` as the group name. [Read more about target groups](../concepts/target-group.md).
  1. Click **Create**.
  
{% endlist %}

It may take a few minutes to create an instance group. Wait until the group [status](../../compute/concepts/instance-groups/statuses.md#group-statuses) switches to `RUNNING`, and all VMs in it, to `RUNNING_ACTUAL`.

![ig-running](../../_assets/application-load-balancer/tutorials/virtual-hosting/ig-running.png)

## Create a log group in Yandex Cloud Logging {#create-log-group}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder where you want to create a [log group](../../logging/concepts/log-group.md).
    1. Navigate to **Cloud Logging**.
    1. Click **Create group**.
    1. Enter a name, e.g., `alb-logging-group`, and description for the log group.
    1. Set the log group record retention period.
    1. Click **Create group**.

{% endlist %}

## Create the required resources in Yandex Application Load Balancer {#create-alb-resources}

### Create a backend group {#create-backend-group}

You must link the target group created with the instance group to the [backend group](../concepts/backend-group.md) that defines traffic allocation settings.

For the backends, the group will implement a [health check](../concepts/backend-group.md#health-checks): the load balancer will periodically send health check requests to the VMs and expect a response for a certain period.

To create a backend group:

{% list tabs group=instructions %}

- Management console {#console}

  1. Open the [management console](https://console.yandex.cloud).
  1. Navigate to **Application Load Balancer**.
  1. In the left-hand panel, select ![image](../../_assets/console-icons/cubes-3-overlap.svg) **Backend groups**. Click **Create backend group**.
  1. Enter the backend group **Name**: `alb-logging-bg`.
  1. Under **Backends**, click **Add**.
  1. Enter the backend **Name**: `alb-logging-backend`.
  1. In the **Target groups** field, select the `alb-logging-tg` group.
  1. Specify **Port** the backend VMs will use to receive incoming traffic from the load balancer: `80`.
  1. Click **Add health check**.
  1. Specify the **Port** the backend VMs will use to accept health check connections: `80`.
  1. Specify the **Path** the load balancer will use for health checks: `/`.
  1. Click **Create**.
  
{% endlist %}

### Create and configure an HTTP router {#create-http-router}

The backend group should be linked to an [HTTP router](../concepts/http-router.md) that defines the HTTP routing rules.

To create an HTTP router:

{% list tabs group=instructions %}

- Management console {#console}

  1. Open the [management console](https://console.yandex.cloud).
  1. Navigate to **Application Load Balancer**.
  1. In the left-hand panel, select ![image](../../_assets/console-icons/route.svg) **HTTP routers**. Click **Create HTTP router**.
  1. Specify the HTTP router **Name**: `alb-logging-router`.
  1. Click **Add virtual host**.
  1. Specify the virtual host **Name**: `alb-logging-host`.
  1. Click **Add route**.
  1. Specify the route **Name**: `alb-logging-route`.
  1. In the **Backend group** field, select the `alb-logging-bg` group.
  1. Click **Create**.

{% endlist %}

### Create an L7 load balancer {#create-l7-balancer}

To create a load balancer:

{% list tabs group=instructions %}

- Management console {#console}

  1. Open the [management console](https://console.yandex.cloud).
  1. Navigate to **Application Load Balancer**.
  1. Click **Create L7 load balancer** and select **Manual**.
  1. Enter the load balancer **Name**: `alb-logging-balancer`.
  1. Under **Network settings**, select `alb-logging-network` and the `alb-logging-sg-balancer` security group that you created earlier.
  1. Under **Log settings**, specify `alb-logging-group`.
  1. Under **Listeners**, click **Add listener**.
  1. Enter the listener **Name**: `alb-logging-listener`.
  1. In the **Protocol** field, select `HTTPS`.
  1. In the **HTTP router** field, select the `alb-logging-router` router you [created earlier](#create-http-router).
  1. Click **Create**.

{% endlist %}

## Create the required resources in Yandex Cloud Functions {#set-up-sf}

### Create a function for processing data {#set-up-sf-create-function}

The [function](../../functions/concepts/function.md) will receive messages from the log group and write them to the table [created earlier](#set-up-db-create-table).

To create a function:

{% list tabs group=instructions %}

- Management console {#console}

  1. Open the [management console](https://console.yandex.cloud).
  1. Navigate to **Cloud Functions**.
  1. Click **Create function**.
  1. Enter the function name: `alb-logging-function`.
  1. Click **Create**. After creating the function, you will be automatically redirected to the **Editor** page.
  1. Select **Python** **3.8** as the runtime environment and click **Continue**.
  1. Clear the file editing area and paste the following code into it:
  
     {% cut "Function code" %}
     
     ```python
     import os
     import logging
     import psycopg2
     import json
     
     logger = logging.getLogger()
     logger.setLevel(logging.INFO)
     verboseLogging = eval(os.environ['VERBOSE_LOG'])
     if verboseLogging:
         logger.info('Loading handler function')
     
     def handler(event, context):
         statusCode = 500
         
         if verboseLogging:
             logger.info(event)
             logger.info(context)
         
         connection_string = (
             "host='{db_hostname}' port='{db_port}' dbname='{db_name}' "
             "user='{db_user}' password='{db_password}' sslmode='require'"
         ).format(
             db_hostname=os.environ['DB_HOSTNAME'],
             db_port=os.environ['DB_PORT'],
             db_name=os.environ['DB_NAME'],
             db_user=os.environ['DB_USER'],
             db_password=os.environ['DB_PASSWORD']
         )
             
         if verboseLogging:
             logger.info(f'Connecting: {connection_string}')
     
         conn = psycopg2.connect(connection_string)
         cursor = conn.cursor()
     
         messages = event['messages'][0]['details']['messages']
     
         for message in messages:
             alb_message = message['json_payload']
             alb_message['table_name'] = 'load_balancer_requests'
             insert_statement = (
                 'INSERT INTO {table_name} ' 
                 '(type, "time", http_status, backend_ip, request_time) ' 
                 'VALUES(\'{type}\', timestamptz \'{time}\', \'{http_status}\', ' 
                 '\'{backend_ip}\', {request_processing_times[request_time]});'
             ).format(**alb_message)
     
             if verboseLogging:
                 logger.info(f'Exec: {insert_statement}')
             try:
                 cursor.execute(insert_statement)
                 statusCode = 200
             except Exception as error:
                 logger.error(error)
             
             conn.commit()
             
         cursor.close()
         conn.close()
     
         return {
             'statusCode': statusCode,
             'headers': {
                 'Content-Type': 'text/plain'
             }
         }
     ```

     {% endcut %}
  
  1. Specify the following version parameters:
  
     * **Timeout**: `10`
     * **Memory**: `128 MB`
  
  1. Select the `alb-logging-service-account` service account you created earlier. The function will write data to the DB on behalf of this account.
  
  1. Add these environment variables:
  
     * `VERBOSE_LOG`: Parameter displaying detailed information about the function. Type in `True`.
     * `DB_HOSTNAME`: Name of the PostgreSQL database host to connect to.
     * `DB_PORT`: Port for the connection.
     * `DB_NAME`: Name of the database to connect to.
     * `DB_USER`: Username for the connection.
     * `DB_PASSWORD`: Password you entered when [creating your cluster](#cluster).
  
     To define the values of connection parameters:
  
     1. Open the [management console](https://console.yandex.cloud).
     1. Navigate to **Managed Service for&nbsp;PostgreSQL**.
     1. Select the `alb-logging-cluster` cluster.
     1. In the line with the database you need, click ![image](../../_assets/console-icons/ellipsis.svg).
     1. Select **Connect**.
     1. On the **Shell** tab, find a sample connection string.
     1. Move the values of the `host`, `port`, `dbname`, and `user` variables to the appropriate **Value** field for the function environment variables.
  
  1. Click **Save changes**.

{% endlist %}

### Create a trigger {#set-up-sf-create-trigger}

The [trigger](../../functions/concepts/trigger/index.md) will receive copies of messages from the load balancer and forward them to the function for processing.

To create a trigger:

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), select the folder where you want to create a trigger.

    1. Navigate to **Cloud Functions**.

    1. In the left-hand panel, select ![image](../../_assets/console-icons/gear-play.svg) **Triggers**.

    1. Click **Create trigger**.

    1. Under **Basic settings**:

        * Enter a name for the trigger, e.g., `alb-logging-trigger`.
        * In the **Type** field, select `Cloud Logging`.
        * In the **Launched resource** field, select `Function`.

    1. Under **Cloud Logging settings**:
        * In the **Log group** field, select `alb-logging-group`.
        * In the **Resource types** field, specify `alb.loadBalancer`.

    1. Under **Batch message settings**:
        * In the **Waiting time, s** field, specify `15`.
        * In the **Batch size** field, specify `10`.

    1. Under **Function settings**, select the function you previously created, and specify:

        * Tag of the function version: `$latest`.
        * Service account you created earlier.

    1. Click **Create trigger**.

- CLI {#cli}

    If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../cli/quickstart.md#install).

    The folder used by default is the one specified when [creating](../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

    To create a trigger that invokes a function, run this command:

    ```bash
    yc serverless trigger create logging alb-logging-trigger \
      --log-group-name <log_group_name> \
      --resource-types alb.loadBalancer \
      --batch-size 10 \
      --batch-cutoff 15s \
      --invoke-function-name alb-logging-function \
      --invoke-function-service-account-name alb-logging-service-account \
    ```

  Where:

  * `--log-group-name`: Name of the log group you [created earlier](#create-log-group).
  * `--resource-types`: Log group resource types.
  * `--invoke-function-name`: Name of the function you [created earlier](#set-up-sf-create-function).
  * `--invoke-function-service-account-name`: Name of the service account created together with the function.
  * `--batch-size`: Maximum number of messages sent to the function at the same time.
  * `--batch-cutoff`: Maximum time interval between consecutive messages to the function.
  
  For more information about this command, see the [CLI reference](../../cli/cli-ref/serverless/cli-ref/trigger/create/logging.md).
  
- API {#api}

  Use the [TriggerService/Create](../../functions/triggers/api-ref/grpc/Trigger/create.md) gRPC API call or the [create](../../functions/triggers/api-ref/Trigger/create.md) REST API method.
  
{% endlist %}
  
## Test the load balancer and logging {#test}

1. Get the public IP address of the load balancer:

   {% list tabs group=instructions %}
   
   - Management console {#console}
   
     1. Open the [management console](https://console.yandex.cloud).
     1. Navigate to **Application Load Balancer**.
     1. Find the `alb-logging-balancer` load balancer in the list and copy its IP address.
     
   {% endlist %}
   
1. In your browser, open `http://<load_balancer_IP_address>`. Refresh the page several times.
1. Make sure the logs contain information about your requests to the load balancer:

   {% list tabs group=instructions %}
   
   - Management console {#console}
   
     1. Open the [management console](https://console.yandex.cloud).
     1. Navigate to **Managed Service for&nbsp;PostgreSQL**.
     1. Select the `alb-logging-cluster` cluster.
     1. Navigate to the **SQL** tab.
     1. Select the user that you [created together with the cluster](#set-up-db-create-cluster) and enter their password.
     1. Select the database you created together with the cluster, and click **Connect**.
     1. Click the `load_balancer_requests` table. You should now see the first rows of this table with your requests to the load balancer.
     
   {% endlist %}

## How to delete the resources you created {#clear-out}

To shut down the load balancer and stop paying for the resources you created: 

1. [Delete](../operations/application-load-balancer-delete.md) the `alb-logging-balancer` L7 load balancer.
1. [Delete](../operations/http-router-delete.md) the `alb-logging-router` HTTP router.
1. [Delete](../operations/backend-group-delete.md) the `alb-logging-bg` backend group.
1. [Delete](../../compute/operations/instance-groups/delete.md) the `alb-logging-ig` instance group.
1. [Delete](../../functions/operations/trigger/trigger-delete.md) the `alb-logging-trigger` trigger.
1. [Delete](../../functions/operations/function/function-delete.md) the `alb-logging-function` function.
1. [Delete](../../managed-postgresql/operations/cluster-delete.md) the `alb-logging-cluster` cluster.
1. [Delete](../../logging/operations/delete-group.md) the `alb-logging-group` log group.