karmada icon indicating copy to clipboard operation
karmada copied to clipboard

Support Karmada components output the log by using json format

Open wuyingjun-lucky opened this issue 2 years ago • 9 comments

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

wuyingjun-lucky avatar Jul 24 '22 12:07 wuyingjun-lucky

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?

RainbowMango avatar Jul 25 '22 01:07 RainbowMango

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

wuyingjun-lucky avatar Jul 25 '22 01:07 wuyingjun-lucky

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

@lonelyCZ what's your opinion?

RainbowMango avatar Jul 25 '22 06:07 RainbowMango

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.

lonelyCZ avatar Jul 25 '22 06:07 lonelyCZ

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

XiShanYongYe-Chang avatar Mar 01 '24 10:03 XiShanYongYe-Chang

@XiShanYongYe-Chang: Closing this issue.

In response to this:

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. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

karmada-bot avatar Mar 01 '24 10:03 karmada-bot

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.

yizhang-zen avatar May 07 '24 19:05 yizhang-zen

@yizhang-zen Thanks for your feedback. /reopen

XiShanYongYe-Chang avatar May 08 '24 01:05 XiShanYongYe-Chang

@XiShanYongYe-Chang: Reopened this issue.

In response to this:

@yizhang-zen Thanks for your feedback. /reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

karmada-bot avatar May 08 '24 01:05 karmada-bot