gofr icon indicating copy to clipboard operation
gofr copied to clipboard

Disable Logs for Health and Alive Routes

Open leonardobiffi opened this issue 6 months ago • 1 comments
trafficstars

Is your feature request related to a problem? Please describe.
I'm always frustrated when my logs are cluttered with repetitive entries from health check requests. This makes it difficult to identify more critical issues in the logs since health and alive routes are constantly being called.

{"level":"INFO","time":"2025-04-23T17:53:53.76753377Z","message":{"trace_id":"59357705d3dcaa0b86617d4909a953cf","span_id":"2050085ec4e91954","start_time":"2025-04-23T17:53:53.76641276+00:00","response_time":1117,"method":"GET","user_agent":"kube-probe/1.32+","ip":"10.10.20.130:39200","uri":"/.well-known/health","response":200},"gofrVersion":"v1.36.0"}

{"level":"INFO","time":"2025-04-23T17:53:54.711014144Z","message":{"trace_id":"6525ab152bfb93c9141b9fa6f2814c4f","span_id":"a1fde3166a3eaf7e","start_time":"2025-04-23T17:53:54.710916671+00:00","response_time":94,"method":"GET","user_agent":"kube-probe/1.32+","ip":"10.10.20.130:39204","uri":"/.well-known/alive","response":200},"gofrVersion":"v1.36.0"}

Describe the solution you'd like
I would like an option to disable logging for the health (/.well-known/health) and alive (/.well-known/alive) routes. This would help reduce log noise and allow for easier monitoring of important events.

Describe alternatives you've considered
An alternative solution could be to change the log level for these specific routes, but completely disabling logs would be more effective in reducing clutter.

Additional context
This feature would be beneficial for environments where health checks are frequent, such as in Kubernetes, and would improve the overall log management experience.

leonardobiffi avatar Apr 23 '25 17:04 leonardobiffi

We can introduce an environment variable LOG_DISABLE_PROBES, which will default to false. But when set to true, will not log these lines.

vikash avatar Apr 24 '25 04:04 vikash