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
nithu0115
left a comment
There was a problem hiding this comment.
Thanks @jayanthvn for the fixing this. Need some more changes. Please see comments inline..
d86a487 to
1ce136e
Compare
d3d77f6 to
8756bba
Compare
mogren
left a comment
There was a problem hiding this comment.
Thanks @jayanthvn and @nithu0115
|
|
||
| log_in_json() | ||
| { | ||
| FILENAME="${0##*/}" |
There was a problem hiding this comment.
Hadn't seen "${0##*/}" before 😄
There was a problem hiding this comment.
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.