Skip to content

Include level in JSON log messages (useful for automatic status mapping in DataDog) #1426

Open
@cbugneac-nex

Description

@cbugneac-nex

What would you like to be added:
Include the level in the JSON log messages.

Why is this needed:
So that it's clear what type of log messages are these, e.g info, warning, error, etc.
At the moment these JSON log messages:

{"ts":1708343903247.908,"caller":"options/serving.go:374","msg":"Generated self-signed cert (/tmp/apiserver.crt, /tmp/apiserver.key)","v":0}                                                                                   │
{"ts":1708343906442.6155,"caller":"aggregated/handler.go:275","msg":"Adding GroupVersion metrics.k8s.io v1beta1 to ResourceManager","v":0}                                                                                     │
{"ts":1708343906652.7542,"caller":"server/secure_serving.go:213","msg":"Serving securely on :10250","v":0}                                                                                                                     │
{"ts":1708343906652.7927,"caller":"headerrequest/requestheader_controller.go:169","msg":"Starting RequestHeaderAuthRequestController","v":0}                                                                                   │
{"ts":1708343906652.8008,"caller":"cache/shared_informer.go:311","msg":"Waiting for caches to sync for RequestHeaderAuthRequestController","v":0}                                                                              │
{"ts":1708343906652.823,"caller":"dynamiccertificates/dynamic_serving_content.go:132","msg":"Starting controller","v":0,"name":"serving-cert::/tmp/apiserver.crt::/tmp/apiserver.key"}                                         │
{"ts":1708343906652.873,"caller":"dynamiccertificates/tlsconfig.go:240","msg":"Starting DynamicServingCertificateController","v":0}                                                                                            │
{"ts":1708343906652.9602,"caller":"dynamiccertificates/configmap_cafile_content.go:202","msg":"Starting controller","v":0,"name":"client-ca::kube-system::extension-apiserver-authentication::client-ca-file"}                 │
{"ts":1708343906738.6284,"caller":"cache/shared_informer.go:311","msg":"Waiting for caches to sync for client-ca::kube-system::extension-apiserver-authentication::client-ca-file","v":0}                                      │
{"ts":1708343906738.739,"caller":"dynamiccertificates/configmap_cafile_content.go:202","msg":"Starting controller","v":0,"name":"client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file"}    │
{"ts":1708343906738.7761,"caller":"cache/shared_informer.go:311","msg":"Waiting for caches to sync for client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file","v":0}                        │
{"ts":1708343906838.8875,"caller":"cache/shared_informer.go:318","msg":"Caches are synced for client-ca::kube-system::extension-apiserver-authentication::client-ca-file","v":0}                                               │
{"ts":1708343906838.9417,"caller":"cache/shared_informer.go:318","msg":"Caches are synced for client-ca::kube-system::extension-apiserver-authentication::requestheader-client-ca-file","v":0}                                 │
{"ts":1708343906839.1077,"caller":"cache/shared_informer.go:318","msg":"Caches are synced for RequestHeaderAuthRequestController","v":0}

are detected in DataDog as errors. Adding level would allow automatic mapping to correct status.
image

Used args:

            args:
              - --secure-port=10250
              - --cert-dir=/tmp
              - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
              - --kubelet-use-node-status-port
              - --metric-resolution=15s
              - --logging-format=json

/kind feature

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions