kyverno: [Bug] Kyverno JSON logs produce duplicate keys

Kyverno Version

1.8.3

Description

For example:

{
  "level": "Level(-4)",
  "ts": 1670261642.7125623,
  "logger": "webhooks.resource.validate",
  "caller": "resource/handlers.go:120",
  "msg": "processing policies for validate admission request",
  "kind": "coordination.k8s.io/v1, Kind=Lease",
  "namespace": "keda",
  "name": "operator.keda.sh",
  "operation": "UPDATE",
  "uid": "bccab18f-bc09-4805-b7a2-5d7fb21f6d86",
  "user": {
    "username": "system:serviceaccount:keda:keda-operator",
    "uid": "729bc5a7-663f-4828-8ccb-6dfe930a88b5",
    "groups": [
      "system:serviceaccounts",
      "system:serviceaccounts:keda",
      "system:authenticated"
    ],
    "extra": {
      "authentication.kubernetes.io/pod-name": [
        "keda-operator-7d68f6c6b6-l8r5z"
      ],
      "authentication.kubernetes.io/pod-uid": [
        "8d2a6b8f-536d-43d4-91e7-4c5b7033543c"
      ]
    }
  },
  "kind": "Lease",
  "validate": 0,
  "mutate": 0,
  "generate": 0
}

Notice duplicate kind key, i.e.: image

This can be annoying when trying to manipulate the output with tools like jq.

Slack discussion

No response

Troubleshooting

  • I have read and followed the documentation AND the troubleshooting guide.
  • I have searched other issues in this repository and mine is not recorded.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 16 (15 by maintainers)

Most upvoted comments

True, we need to be super careful with keys.