karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.14k stars 813 forks source link

Support Karmada components output the log by using json format #2242

Open wuyingjun-lucky opened 1 year ago

wuyingjun-lucky commented 1 year ago

What would you like to be added: We have introduced k8s.io/component-base/cli at 2049 and add json log register to imports. But json log register (_ "k8s.io/component-base/logs/json/register") does not work because we do not apply the log flags yet. So we can not use the flags --log-format=json to output karmada components logs by using json format. Like image

Why is this needed: Introduce json format log to karmada components

RainbowMango commented 1 year ago

But json log register (_ "k8s.io/component-base/logs/json/register") does not work because we do not apply the log flags yet. So we can not use the flags --log-format=json to output karmada components logs by using json format.

Do you mean we need to introduce a new flag --log-format?

wuyingjun-lucky commented 1 year ago

But json log register (_ "k8s.io/component-base/logs/json/register") does not work because we do not apply the log flags yet. So we can not use the flags --log-format=json to output karmada components logs by using json format.

Do you mean we need to introduce a new flag --log-format?

--log-format can be worked if we bound k8s.io/component-base/logs configuration with flags like k8s) Even though-log-format is optional because the value is always text if we do not set it to json If you think we do not need to introduce this, we may delete the imports _ "k8s.io/component-base/logs/json/register" introduced by 2049

RainbowMango commented 1 year ago

I don't know if we really need the json format logs for now.

@lonelyCZ what's your opinion?

lonelyCZ commented 1 year ago

This is a feature provided by k8s.io/component-base/logs, I think it should be useful for specific users.

But we don't seem to have this need right now, I think if it is not complex, we can support it, or we will do it when real users ask this feature.

XiShanYongYe-Chang commented 2 months ago

As a lack of activity, let's close this first, feel free to reopen it if you still need it. /close

karmada-bot commented 2 months ago

@XiShanYongYe-Chang: Closing this issue.

In response to [this](https://github.com/karmada-io/karmada/issues/2242#issuecomment-1972897132): >As a lack of activity, let's close this first, feel free to reopen it if you still need it. >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
yizhang-zen commented 1 week ago

Mild bump! It would be great if Karmada supports json log format, as Kubernetes supports it in 1.19. Can we have a --logging-format=json flag that change the format of logs from klog native format to JSON format? Our use case is we ship all karmada logs to Datadog (it automatically parses JSON-formatted logs) and soon reach the quota. We want to analyze logs then drop logs in certain patterns. For now, we have to have parser that datadog provide for glog format. It will bring values for us but low priority.

XiShanYongYe-Chang commented 1 week ago

@yizhang-zen Thanks for your feedback. /reopen

karmada-bot commented 1 week ago

@XiShanYongYe-Chang: Reopened this issue.

In response to [this](https://github.com/karmada-io/karmada/issues/2242#issuecomment-2099561115): >@yizhang-zen Thanks for your feedback. >/reopen Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.