-
Notifications
You must be signed in to change notification settings - Fork 748
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
JSON output format for the entrypoint script #1066
Conversation
I think I need to update #907 a bit. Having these log messages definitely helps us debug issues, so it would be better to have a function that logs messages in JSON format instead, so that it matches what zap outputs. Something like:
|
Thanks @mogren . It makes sense and I can look into it. |
a5446a4
to
58d1788
Compare
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.
Thanks @jayanthvn for the fixing this. Need some more changes. Please see comments inline..
d86a487
to
1ce136e
Compare
d3d77f6
to
8756bba
Compare
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.
LGTM 👍
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.
Thanks @jayanthvn and @nithu0115
@@ -26,13 +26,22 @@ set -eu | |||
# turn on bash's job control | |||
set -m | |||
|
|||
log_in_json() | |||
{ | |||
FILENAME="${0##*/}" |
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.
Hadn't seen "${0##*/}"
before 😄
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.
From stack overflow - "for the variable $0, and the pattern '/', the two hashes mean from the beginning of the parameter, delete the longest (or greedy) match—up to and including the pattern. So, where $0 is the name of a file, eg., $HOME/documents/doc.txt, then the parameter would be expanded as: doc.txt" :D
*Issue #907 , if available: JSON o/p format for the logs generated from entrypoint script
Description of changes:
dev-dsk-varavaj-2b-72f02457 % kubectl logs aws-node-2sq6w -n kube-system
{"level":"info","ts":"2020-07-01T02:21:56.104Z","caller":"entrypoint.sh","msg":"Copying CNI plugin binaries ... "}
{"level":"info","ts":"2020-07-01T02:21:56.120Z","caller":"entrypoint.sh","msg":"Starting IPAM daemon in the background ... "}
{"level":"info","ts":"2020-07-01T02:21:56.127Z","caller":"entrypoint.sh","msg":"Checking for IPAM connectivity ... "}
{"level":"info","ts":"2020-07-01T02:21:58.148Z","caller":"entrypoint.sh","msg":"Copying CNI plugin binary and config file ... "}
{"level":"info","ts":"2020-07-01T02:21:58.167Z","caller":"entrypoint.sh","msg":"Successfully copied CNI plugin binary and config file."}
{"level":"info","ts":"2020-07-01T02:21:58.168Z","caller":"entrypoint.sh","msg":"Foregrounding IPAM daemon ..."}
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.