kiwigrid / k8s-sidecar

This is a docker container intended to run inside a kubernetes cluster to collect config maps with a specified label and store the included files in a local folder.
MIT License
563 stars 181 forks source link

Log python exceptions in json format #331

Closed jkroepke closed 3 months ago

jkroepke commented 6 months ago

k8s-sidecare supports json logging, however for any python related exception, the standard format appears on stdout. This is really hard, because on loki, each single line is a dedicated message.

It would be great, if exceptions could be caught in general and can be logging by the configured logging handler

ChristianGeie commented 6 months ago

JSON logging is also on our bucket list. We wanted to implement this so that you can switch between plain and JSON logging via feature toggle. On the other hand, in a k8s environment we could also do JSON logging exclusively.

Do you already have an approach or a PR draft that implements the JSON logging feature?

jkroepke commented 6 months ago

Currently, JSON logging is implement, only exception are raises on stdout, as-is.

An draft is here: https://github.com/kiwigrid/k8s-sidecar/pull/333

ChristianGeie commented 3 months ago

done see https://github.com/kiwigrid/k8s-sidecar/pull/333