argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.92k stars 5.46k forks source link

Application controller sends non json log messages #6761

Open Wikiwix opened 3 years ago

Wikiwix commented 3 years ago

The ArgoCD Application Controller with logFormat set to json still gives son non-json loglines:

{"level":"info","msg":"Start syncing cluster","server":"https://kubernetes.default.svc","time":"2021-07-20T08:03:07Z"}
W0720 08:03:07.628673       1 warnings.go:70] extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
W0720 08:03:07.730083       1 warnings.go:70] extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
{"application":"argocd","level":"info","msg":"Refreshing app status (controller refresh requested), level (0)","time":"2021-07-20T08:03:08Z"}
{"application":"ingress-prometheus","level":"info","msg":"Refreshing app status (controller refresh requested), level (0)","time":"2021-07-20T08:03:08Z"}
{"application":"prometheus-operator","level":"info","msg":"Refreshing app status (controller refresh requested), level (0)","time":"2021-07-20T08:03:08Z"}

Steps to reproduce

To reproduce simply start the applciationcontroller with --logFormat json and force a warning by e.g. defining an Ingress with a deprecated apiVersion as in the sample above.

Expected behavior

All loglines follow the same JSON format it logFormat is sett accordingly

Version

argocd: v2.0.4+0842d44.dirty
  BuildDate: 2021-06-23T11:32:37Z
  GitCommit: 0842d448107eb1397b251e63ec4d4bc1b4efdd6e
  GitTreeState: dirty
  GoVersion: go1.16.5
  Compiler: gc
  Platform: linux/amd64
argocd-server: v2.0.4+0842d44
  BuildDate: 2021-06-23T01:27:53Z
  GitCommit: 0842d448107eb1397b251e63ec4d4bc1b4efdd6e
  GitTreeState: clean
  GoVersion: go1.16
  Compiler: gc
  Platform: linux/amd64
  Ksonnet Version: v0.13.1
  Kustomize Version: v3.9.4 2021-02-09T19:22:10Z
  Helm Version: v3.5.1+g32c2223
  Kubectl Version: v0.20.4
  Jsonnet Version: v0.17.0
bryanhorstmann commented 8 months ago

The fact that the application controller still shows non-json logs even if logFormat is set to json is having a negative impact for me due to this issue: https://github.com/argoproj/argo-cd/issues/9422

I cannot drop the offending messages on my logging platform as they're not in JSON. My logging platform does not support dropping messages based on a partial match of a field.