SLB can automatically save health check logs generated in three days. If too many health check logs are generated and affect your maintenance, you can reduce health check logs or prevent certain logs from being generated through the following methods.
- Get access logs
- Adjust health check frequency
- Close Layer-7 health checks
- Change Layer-7 SLB to Layer-4 SLB
- Disable application logs on the health check page
Get access logs
HTTP health checks use the HEAD request method by default (the GET method will be supported later). Therefore, you can obtain access logs by filtering out HEAD requests.
Adjust health check frequency
You can increase the interval between two health checks to reduce the health check frequency and generated logs.
Potential risks
After you increase the interval, if a backend ECS instance fails, the time needed for SLB to detect the faulty ECS instance is increased accordingly.
Procedure
- Log on to the SLB console.
- On the Server Load Balancer page, click the ID of the target SLB instance.
- Click the Listeners tab, find the target listener, and click Configure in the Actions column.
- On the Configure Listener page, click Next and then click Next again to go to the Health Check tab.
- Adjust the Health Check Interval. Value range: 1 to 50. Unit: seconds. The greater the interval is, the lower the
health check frequency is, and the fewer logs are generated by backend servers. Modify
the interval according to your actual situation.
- Click OK.
Close Layer-7 health checks
When Layer-7 (HTTP or HTTPS) SLB is used, health checks are performed through HTTP HEAD requests. Application logs of backend servers record the health check requests, leading to a large number of logs.
Potential risks
After you close HTTP/HTTPS health checks, SLB does not check backend servers. If a backend server fails, the traffic cannot be automatically forwarded to other normal backend servers.
Procedure
- Log on to the SLB console.
- On the Server Load Balancer page, click the ID of the target SLB instance.
- Click the Listeners tab, find the target listener, and click Configure in the Actions column.
- On the Configure Listener page, click Next and then click Next again to go to the Health Check tab.
- Turn off Enable Health Check.
- Click OK.
Change Layer-7 SLB to Layer-4 SLB
Layer-4 health checks are preformed through TCP three-way handshakes and generate no application logs. If you change Layer-7 SLB to Layer-4 SLB, the number of application logs can be reduced.
Potential risks
After you change the Layer-7 SLB to Layer-4 SLB, SLB checks only the status of the listener port and does not check the HTTP status. In this way, SLB cannot detect the exceptions occurring to HTTP applications in real time.
Procedure
- Log on to the SLB console.
- On the Server Load Balancer page, click the ID of the target SLB instance.
- Click the Listeners tab, find the target listener, and click Configure in the Actions column.
- On the Configure Listener page, click Next and then click Next again to go to the Health Check tab.
- Change the Health Check Protocol to TCP.
- Click OK.
Disable application logs on the health check page
You can configure an independent site for health checks and disable application logs of this site. This method can also reduce the number of health checks. For example, the service site is abc.123.com. You can use test.123.com as the health check site and disable logs of test.123.com.
Potential risks
If the health check site is running normally, but an exception occurs to the service site, health checks cannot detect the exception of the service site.
Procedure
- Create a new health check site and health check page on the backend server and disable
logs. In this example, NGINX is used.
- Log on to the SLB console.
- On the Server Load Balancer page, click the ID of the target SLB instance.
- Click the Listeners tab, find the target listener, and click Configure in the Actions column.
- On the Configure Listener page, click Next and then click Next again to go to the Health Check tab.
- In the Health Check Domain Name field, enter the domain name of the health check site. In the Health Check Path field, enter the path of the health check page.
- Click OK.