-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
proxy-injector doesn't respect JSON logging configuration for all log messages #13168
Comments
Hey @woz5999 , I would love to work on this issue. |
That's great. Let me know what I can do to assist. |
Look like this issue is still open! I can take it over if needed. |
It looks like the file The lines that do respect the json format seem to be generated in |
I'm not sure which maintainers would be the ones to review the resulting PR, but that assessment and approach seems reasonable to me. |
Sounds good! One clarifying question is how were you viewing the logs? Were you using |
You can reproduce this with |
Okay great and one other question. Installation with helm you just used a command similar to: |
Correct, installed via helm |
Ensure consistent JSON logging for proxy-injector container When JSON logging is enabled in the proxy-injector `controllerLogFormat: json` some log messages adhere to the JSON format while others do not. This inconsistency creates difficulty in parsing logs, especially in automated workflows. For example: ``` {"level":"info","msg":"received admission review request \"83a0ce4d-ab81-42c9-abe4-e0ade0f926e2\"","time":"2024-10-10T21:06:18Z"} time="2024-10-10T21:06:18Z" level=info msg="received pod/mypod" ``` Modified the logging implementation in the `controller/proxy-injector/webhook.go` to ensure all log messages follow the JSON format consistently. This was achieved by removing a new instance of the logrus logger that was being created in the file and replacing it with the global logger instance, ensuring all logs respect the controllerLogFormat configuration. Reproduced the issue by enabling JSON logging and observing mixed-format logs when install the emojivoto sample application. Applied the changes and verified that all logs consistently use the JSON format. Ran the linkerd check command and confirmed there are no additional warnings or issues. Tested various scenarios, including pods with and without the injection annotation, to ensure consistent logging behavior. Fixes #13168 Signed-off-by: Micah See [email protected]
What is the issue?
When JSON logging is enabled, the proxy-injector uses the proper JSON format for some log messages, but not all.
How can it be reproduced?
controllerLogFormat: json
Logs, error output, etc
This is an example of mix-format log messages from a proxy-injector pod:
output of
linkerd check -o short
Environment
Possible solution
No response
Additional context
No response
Would you like to work on fixing this bug?
None
The text was updated successfully, but these errors were encountered: