serlo / infrastructure-modules-shared

Apache License 2.0
4 stars 1 forks source link

refactor: avoid verbose kratos logs #34

Closed hugotiburtino closed 1 year ago

hugotiburtino commented 1 year ago

If you have seen kratos logs they are like the following:

time=2023-04-07T18:48:43Z level=info msg=started handling request http_request=map[headers:map[accept:*/* connection:close user-agent:kube-probe/1.23] host:10.4.0.3:4434 method:GET path:/admin/health/ready query:<nil> remote:10.4.0.1:59018 scheme:http]
time=2023-04-07T18:48:43Z level=info msg=started handling request http_request=map[headers:map[accept:*/* connection:close user-agent:kube-probe/1.23] host:10.4.0.3:4434 method:GET path:/admin/health/alive query:<nil> remote:10.4.0.1:59020 scheme:http]
time=2023-04-07T18:48:43Z level=info msg=completed handling request http_request=map[headers:map[accept:
...

and a lot of them repeated ad infinitum. These are just health checks. So, when you have an actual user request and are trying to debug it is quite hard to find the right logs. This PR changes it in order to not log the health checks any more.

~WARNING: it may be tricky, sometimes the health checks can indeed give us essential information, above all when we have 503 service unavailable. These cases are rare but if they happen we have to locally revert this changes while debugging. All in all it is better though to not have so much logs.~ edit: not to worry: error continues to the logged

AndreasHuber commented 1 year ago

The health logs we want to get rid of are level info. Are there info-level logs that we do want? If not then we could maybe set the log level to warning instead of disabling health logs. We should then see the cases of 503 service unavailable because I assume those would be level error.

hugotiburtino commented 1 year ago

Info logs are also important when debugging. I've checked again and, fortunately, errors at health checks continue to be logged, so no worry about it.