argo-cd icon indicating copy to clipboard operation
argo-cd copied to clipboard

inconsistent log output format

Open seankhliao opened this issue 3 years ago • 3 comments

Checklist:

  • [x] I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • [ ] I've included steps to reproduce the bug.
  • [x] I've pasted the output of argocd version.

Describe the bug

k8s.io/client-go outputs logs through k8s.io/klog{,/v2} which is a different format (glog style) than argocd (logfmt or json), making it annoying to parse, example below

Something else outputs plaintext

To Reproduce

Not sure how to reliably generate errors in client-go

Expected behavior

logs output in consistent structured format

Version

argocd: v1.8.7+eb3d1fb
  BuildDate: 2021-03-03T07:12:02Z
  GitCommit: eb3d1fb84b9b77cdffd70b14c4f949f1c64a9416
  GitTreeState: clean
  GoVersion: go1.14.12
  Compiler: gc
  Platform: linux/amd64

Logs

From argocd-application-controller

time="2021-03-04T09:41:42Z" level=info msg="Ignore status for CustomResourceDefinitions"
time="2021-03-04T09:41:42Z" level=info msg="Comparing app state (cluster: https://kubernetes.default.svc, namespace: xxx)" application=xxx
E0304 09:41:42.208565       1 retrywatcher.go:130] Watch failed: Get "https://10.250.0.1:443/apis/status.gatekeeper.sh/v1beta1/constraintpodstatuses?allowWatchBookmarks=true&resourceVersion=497293846&watch=true": context canceled
E0304 09:41:42.211088       1 retrywatcher.go:130] Watch failed: Get "https://10.250.0.1:443/apis/networking.k8s.io/v1/networkpolicies?allowWatchBookmarks=true&resourceVersion=497293845&watch=true": context canceled
E0304 09:41:42.211871       1 retrywatcher.go:130] Watch failed: Get "https://10.250.0.1:443/apis/storage.k8s.io/v1/storageclasses?allowWatchBookmarks=true&resourceVersion=497293833&watch=true": context canceled
E0304 09:41:42.214747       1 retrywatcher.go:130] Watch failed: Get "https://10.250.0.1:443/apis/velero.io/v1/restores?allowWatchBookmarks=true&resourceVersion=497293835&watch=true": context canceled
E0304 09:41:42.214779       1 retrywatcher.go:130] Watch failed: Get "https://10.250.0.1:443/apis/acme.cert-manager.io/v1/orders?allowWatchBookmarks=true&resourceVersion=497293881&watch=true": context canceled
time="2021-03-04T09:41:54Z" level=info msg="Skipping auto-sync: application status is Unknown" application=xxx
time="2021-03-04T09:41:54Z" level=info msg="Update successful" application=xxx

From argocd-server

Failed to obtain reader, failed to marshal fields to JSON, json: error calling MarshalJSON for type *grpc.jsonpbMarshalleble: unexpected end of JSON input
{"error":"rpc error: code = Unauthenticated desc = invalid session: oidc: token is expired (Token Expiry: 2021-03-03 14:34:10 +0000 UTC)","grpc.code":"Unauthenticated","grpc.method":"List","grpc.service":"cluster.ClusterService","grpc.start_time":"2021-03-04T09:29:11Z","grpc.time_ms":1.379,"level":"info","msg":"finished unary call with code Unauthenticated","span.kind":"server","system":"grpc","time":"2021-03-04T09:29:11Z"}
Failed to obtain reader, failed to marshal fields to JSON, json: error calling MarshalJSON for type *grpc.jsonpbMarshalleble: invalid character '\x00' in string literal

seankhliao avatar Mar 09 '21 14:03 seankhliao