Disable healthckecks logs in ingress

8/24/2018

I would like to disable the logging of the health checks produced by my Ingress, on my pods.

I have a GCE ingress, distributing two pods, and I would like to clear up the logs i get from them.

Do you have any idea ?

Thanks,

-- Simon Lacoste
google-kubernetes-engine
kubernetes
kubernetes-ingress

1 Answer

8/24/2018

(It's not clear what do you mean by disabling logs. So I'll make an assumption.)

If your application is logging something when it gets a request, you can check the user agent of the request to disable requests from Google Load Balancer health checking.

When you provision a GCE ingress, your app will get a Google Cloud HTTP Load Balancer (L7). This LB will make health requests with header:

User-agent: GoogleHC/1.0

I recommend checking for a case-insensitive header ("user-agent") and again a case-insenstive check to see if its value is starting with "googlehc".

This way, you can distinguish Google HTTP (L7) load balancer health requests and leave them out of your logs.

-- AhmetB - Google
Source: StackOverflow