-
Notifications
You must be signed in to change notification settings - Fork 53
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
Support structured logging #208
Support structured logging #208
Conversation
Welcome @bells17! |
Hi @bells17. Thanks for your PR. I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
281219c
to
856803e
Compare
/ok-to-test |
I apologize for the oversight. I've noticed that the klog functions in use are not aligned with the guidelines below, so I will be changing the status of the Pull Request to Draft for now: |
2f5c597
to
c6dda1f
Compare
The changes are done, so I've changed the PR status back to ready. |
c6dda1f
to
85851cf
Compare
85851cf
to
4574105
Compare
pkg/controller/node_watcher.go
Outdated
@@ -172,7 +171,7 @@ func (watcher *NodeWatcher) WatchNodes() { | |||
return false | |||
} | |||
if !errors.IsNotFound(err) { | |||
klog.V(2).Infof("error getting node %q from informer: %v", key, err) | |||
klog.V(2).ErrorS(err, "Error getting node from informer", "node", key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you keep this at InfoS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xing-yang Sorry for the mistake. I've updated it to use InfoS.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bells17, xing-yang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
I've added JSON logging and changed to use structured logging (e.g., klog.InfoS) in this PR.
With this change, it is now possible to output the logs of the external-health-monitor container in JSON format.
Running the container with the
--logging-format=json
option will output the logs in JSON format.In addition, I've modified the log messages based on the following guideline:
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#remove-string-formatting-from-log-message
I’ve update the klog functions in use according to the guidelines provided below, and I've confirmed that they pass the logcheck tests:
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#change-log-functions
related PR: kubernetes-csi/livenessprobe#202
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?: