Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure klog output severity by flags #412

Open
cute-rui opened this issue Aug 9, 2024 · 4 comments
Open

Configure klog output severity by flags #412

cute-rui opened this issue Aug 9, 2024 · 4 comments
Labels
kind/support Categorizes issue or PR as a support question. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@cute-rui
Copy link

cute-rui commented Aug 9, 2024

/kind support

I tried to make klog only output severity above warn to console, but only found verbosity settings. Is there a way to adjust klog flags to change the log output severity level, so that only warnings, errors messages are logged to the console? Any guidance on achieving this would be greatly appreciated.

@k8s-ci-robot k8s-ci-robot added kind/support Categorizes issue or PR as a support question. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 9, 2024
@pohly
Copy link

pohly commented Aug 19, 2024

Perhaps you can use https://pkg.go.dev/k8s.io/klog/v2#SetOutputBySeverity?

@logicalhan
Copy link
Member

/kind support
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 22, 2024
@cute-rui
Copy link
Author

Perhaps you can use https://pkg.go.dev/k8s.io/klog/v2#SetOutputBySeverity?

The issue is that what I deployed is a third-party project that can only be modified through klog flags. For example, the metrics-scraper module of the Kubernetes dashboard outputs unnecessary heartbeat messages, and modifying the code to address this is tedious.

@pohly
Copy link

pohly commented Aug 23, 2024

There are no klog flags for what you want to achieve and given that klog is considered in feature freeze, I also don't want to add some.

If you find that some component is too verbose at normal production verbosity levels (-v=2 in Kubernetes), then the best approach is to bring that up with the maintainers of that component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

4 participants