ui icon indicating copy to clipboard operation
ui copied to clipboard

Access logs for HTTP response 200 with `"error":""` (empty string). Should not include the error key at all

Open johanforssell opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

We visualize our logs with Grafana (via Loki and promtail).

Access logs looks like this

{"time":"2023-03-09T09:19:34.757983797Z","id":"","status":200,"error":"","remote_ip":"MASKED","host":"MASKED","method":"GET","uri":"/api/v1/namespaces/MASKEDtask-queues/SAIT-POLLER-SNMP-PRIMARY?taskQueueType=1","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36","latency":6827916,"latency_human":"6.827916ms","bytes_in":0,"bytes_out":49}

This will be colored RED in Grafana, which I assume happens because there's an error key in the json. As the http status was 200 and the error value was "" (empty string); could you possibly stop filling in the error key?

If you do this, I will not have to learn how to configure Loki/Promtail/Grafana to deal with this myself 😄

Describe the solution you'd like

Do not print "error":"" at all for access logs where the http answer is in the 200 range.

johanforssell avatar Mar 09 '23 09:03 johanforssell