All Products
Search
Document Center

Server Load Balancer:Store and download health check logs

Last Updated:Nov 14, 2024

You can view health check logs generated in the last three days on the Health Check Logs page. To view earlier log data, you must download the log files from the Object Storage Service (OSS) bucket in which the health check logs are stored.

Store health check logs

You can store the health check logs of Classic Load Balancer (CLB) backend servers by using the log storage feature of CLB. CLB retains only health check logs generated in the last three days. To retain health check logs for a longer period of time, you can store them in an OSS bucket.

You can enable or disable the log storage feature at any time. After you enable the log storage feature, CLB creates a folder named AliyunSLBHealthCheckLogs in the selected bucket to store the log files for health checks. CLB generates log files for health checks on an hourly basis. CLB automatically creates a subfolder to store the log files that are generated on the current day. Each subfolder is named based on the date on which the logs are generated. An example subfolder name is 20220907.

A log file is named based on the start hour of the time period in which logs stored in the log file are generated. For example, the log file for storing the logs generated from 00:00:00 to 01:00:00 is named 00.txt, and the log file for storing the logs generated from 01:00:00 to 02:00:00 is named 01.txt.

Note

Health check logs are generated only if the health status of a backend server is abnormal. Log files for health checks are generated on an hourly basis. If no exceptions are detected on backend servers within an hour, no log file for health checks is generated for that hour.

Prerequisites

Step 1: Create a bucket

Make sure that the bucket and the CLB instance are in the same region.

  1. Log on to the OSS console.

  2. In the left-side navigation pane, click Buckets. On the Buckets page, click Create Bucket.

  3. In the Create Bucket panel, configure the parameters and click OK.

    For more information, see Create a bucket.

    Parameter

    Description

    Bucket Name

    The name of the bucket. The name of a bucket cannot be changed after the bucket is created.

    The name must meet the following requirements:

    • The name must be globally unique.

    • The name can contain only lowercase letters, digits, and hyphens (-).

    • The name must start and end with a lowercase letter or a digit.

    • The name must be 3 to 63 characters in length.

    Note

    Do not include your account ID or other sensitive information in the bucket name. The bucket name is included in URLs of objects in the bucket.

    Region

    The region where the bucket is located. The region of a bucket cannot be changed after the bucket is created.

    To access the bucket from an Elastic Compute Service (ECS) instance over an internal network, select the region in which the ECS instance is located. For more information, see OSS domain names.

    Important

    If you want to create a bucket in a region in the Chinese mainland, you must complete real-name registration by submitting your information on the Real-name Registration page.

    Redundancy Type

    The redundancy type of the bucket.

    • LRS

      Locally redundant storage (LRS) stores multiple copies of your data on multiple devices of different facilities in the same zone. LRS provides data durability and availability even if hardware failures occur.

    • ZRS (Recommended)

      ZRS stores multiple copies of your data across multiple zones in the same region. Your data is still accessible even if a zone becomes unavailable.

      Important

      Zone-redundant storage (ZRS) is supported in the following regions: China (Shenzhen), China (Beijing), China (Hangzhou), China (Shanghai), China (Hong Kong), Singapore, and Indonesia (Jakarta). ZRS increases your storage costs and cannot be disabled after it is enabled. We recommend that you exercise caution when you select this redundancy type.

      For more information about ZRS, see Create a ZRS bucket.

Step 2: Authorize CLB to access OSS

After you create a bucket, you must authorize the SLBLogDefaultRole role of CLB to access OSS resources.

Important

The authorization is required only when you configure log storage for the first time.

  1. Log on to the CLB console.

  2. In the left-side navigation pane, choose CLB > Logs > Health Check Log.

  3. On the Health Check Log page, click the Log Storage tab.

  4. On the Log Storage tab, click 1. Activate OSS.

  5. After OSS is activated, click Activate Now in the Step 2: Grant permissions to the RAM user section.

  6. On the Cloud Resource Access Authorization page, read the authorization description and click Confirm Authorization Policy.

  7. Log on to the Resource Access Management (RAM) console.

  8. In the left-side navigation pane, choose Identities > Roles. On the Roles page, find the SLBLogDefaultRole role and click Add Permissions in the Actions column.

  9. In the Add Permissions panel, click System Policy in the Select Policy section, select AliyunOSSFullAccess in the Authorization Policy Name column, and then click OK.

  10. Click Complete.

Step 3: Configure log storage

  1. Log on to the CLB console.
  2. In the left-side navigation pane, choose CLB > Logs > Health Check Log.

  3. On the Health Check Log page, click the Log Storage tab.

  4. On the Log Storage tab, find the region in which the OSS bucket resides and click Configure OSS in the Actions column.

  5. In the Configure OSS panel, configure the parameters and click OK.

    Parameter

    Description

    Select Bucket

    Select a bucket to store the log files.

    Log Type

    Select a log type. In this example, Health Check Log is selected.

  6. On the Log Storage tab, turn on the switch in the Status column to enable the log storage feature.

View health check logs

You can view health check logs generated in the last three days in the SLB console.

  1. Log on to the CLB console.
  2. In the left-side navigation pane, choose CLB (FKA SLB) > Logs > Health Check Log.

  3. On the Health Check Log page, click the Logs tab.

    Note

    Health check logs are generated only if the health status of a backend server is abnormal. Log files for health checks are generated on an hourly basis. If no exceptions are detected on backend servers within an hour, no log file for health checks is generated for that hour.

    • If the following message is displayed in a health check log, the health status of the backend server is abnormal: SLB_instance_IP:port to Added_ECS_instance_IP:port abnormal; cause:XXX. In this case, troubleshoot the issue based on the error message.

    • If the following message is displayed in a health check log, the health status of the backend server returns to normal: SLB_instance_IP:port to Added_ECS_instance_IP:port normal.

Download health check logs

You can download health check logs of CLB instances in the OSS console.

  1. Log on to the OSS console.

  2. In the left-side navigation pane, click Buckets. On the Buckets page, find the bucket that stores the log files for health checks and click the bucket name.

  3. In the left-side bar, choose Object Management > Objects. Click the AliyunSLBHealthCheckLogs/ folder.

  4. Click the log file that you want to download. In the View Details panel, click Download below URL to download the log file.