SLB health checks occur frequently, with several requests per second. Over time, this generates a large volume of web service logs. This not only consumes storage space but also impacts disk performance. In addition to the official recommendation to reduce the health check frequency, there are some alternative approaches.
1. If you are not strict about using HTTP or TCP forwarding protocols, switch to TCP forwarding and disable HTTP health checks.
Advantage: Convenient; simply configure it via the console.
Disadvantage: You lose the ability to detect application-layer anomalies.
2. Create a separate virtual host without logging enabled for health checks. Use different ports or hostnames to ensure health check requests do not hit your main business virtual hosts.
Advantage: Application-level anomalies can still be detected by health checks.
Disadvantage: Virtual host-level anomalies will no longer be detected by SLB health checks.
3. Use rules in web servers like Nginx to configure separate logging for health check URIs. For example, with Nginx:
In the following configuration, define a meaningless URI such as check.html for health checks. Requests to this file will not be logged.
Advantage: Health check logs can be configured flexibly without losing any health check functionality.