abahmed / kwatch

:eyes: monitor & detect crashes in your Kubernetes(K8s) cluster instantly
https://kwatch.dev
MIT License
959 stars 75 forks source link

Logs formatting #301

Closed thomasLeclaire closed 4 months ago

thomasLeclaire commented 4 months ago

Hello!

Current logging of Kwatch use logrus thirdparty which send log to a default formatting logfmt when exported.

Could be cool to be able to choose this format.

in particular when running on GKE, logs are all considered as ERROR : image

not sure how exactly implement this but such config should do the job to allow GKE to auto map stuffs :

logrus.SetFormatter(&log.JSONFormatter{
    FieldMap: logrus.FieldMap{
        logrus.FieldKeyTime:  "time",
        logrus.FieldKeyLevel: "severity",
        logrus.FieldKeyMsg:   "message",
    },
})
abahmed commented 4 months ago

@thomasLeclaire Released on v0.9.0 🎉