Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't log health check endpoint accesses when the request is coming from AWS #115

Open
lorenyu opened this issue Feb 1, 2023 · 1 comment

Comments

@lorenyu
Copy link
Contributor

lorenyu commented Feb 1, 2023

To avoid cluttering the logs, consider removing access logs for the health check endpoint when they are coming from AWS

Implementation note

one possible way to filter is to check if request path is healthcheck and check if user agent starts with ELB-HealthChecker/

@lorenyu lorenyu changed the title Don't log health checks when they are coming from AWS Don't log health check endpoint accesses when the request is coming from AWS Feb 1, 2023
@jamesbursa
Copy link
Contributor

Sample function that was used in AWS:

def is_load_balancer_health_check(request):
    """Test if the request comes from a load balancer."""
    return request.path == "/v1/status" and request.headers.get("User-Agent", "").startswith(
        "ELB-HealthChecker/"
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants