-
Notifications
You must be signed in to change notification settings - Fork 689
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
cmd/contour: Add support for json log formatter #4486
Conversation
Signed-off-by: Tero Saarni <tero.saarni@est.tech>
068240e
to
a336751
Compare
Codecov Report
@@ Coverage Diff @@
## main #4486 +/- ##
==========================================
- Coverage 76.69% 76.64% -0.05%
==========================================
Files 139 139
Lines 12511 12518 +7
==========================================
Hits 9595 9595
- Misses 2669 2676 +7
Partials 247 247
|
After specifying {"level":"info","msg":"args: [serve --xds-address=0.0.0.0 --xds-port=8001 --envoy-service-http-port=8080 --envoy-service-https-port=8443 --contour-cafile=ca.crt --contour-cert-file=tls.crt --contour-key-file=tls.key --config-path=/home/tsaarni/work/devenvs/contour/configs/contour.yaml --log-format=json]","time":"2022-04-19T19:53:52+03:00"}
{"envoy-service-name":"envoy","envoy-service-namespace":"projectcontour","level":"info","msg":"Watching Service for Ingress status","time":"2022-04-19T19:53:52+03:00"}
{"context":"contourEventHandler","level":"info","msg":"started event handler","time":"2022-04-19T19:53:52+03:00"}
{"address":"127.0.0.1:6060","context":"debugsvc","level":"info","msg":"started HTTP server","time":"2022-04-19T19:53:52+03:00"}
{"address":"0.0.0.0:8000","context":"metricsvc","level":"info","msg":"started HTTP server","time":"2022-04-19T19:53:52+03:00"}
{"context":"xds","level":"info","msg":"waiting for informer caches to sync","time":"2022-04-19T19:53:52+03:00"}
{"context":"xds","level":"info","msg":"informer caches synced","time":"2022-04-19T19:53:52+03:00"}
{"caller":"leaderelection.go:248","context":"kubernetes","level":"info","msg":"attempting to acquire leader lease projectcontour/leader-elect...\n","time":"2022-04-19T19:53:52+03:00"}
{"address":"0.0.0.0:8001","context":"xds","level":"info","msg":"started xDS server type: \"contour\"","time":"2022-04-19T19:53:52+03:00"}
{"caller":"leaderelection.go:258","context":"kubernetes","level":"info","msg":"successfully acquired lease projectcontour/leader-elect\n","time":"2022-04-19T19:53:52+03:00"}
{"context":"StatusUpdateHandler","level":"info","msg":"started status update handler","time":"2022-04-19T19:53:52+03:00"}
{"context":"loadBalancerStatusWriter","level":"info","loadbalancer-address":"","msg":"received a new address for status.loadBalancer","time":"2022-04-19T19:53:52+03:00"}
{"context":"contourEventHandler","last_update":109610913,"level":"info","msg":"performing delayed update","outstanding":5,"time":"2022-04-19T19:53:52+03:00"}
{"connection":1,"context":"xds","error":"context canceled","level":"error","msg":"stream terminated","node_id":"envoy-pszrb","node_version":"v1.21.1","resource_names":null,"response_nonce":"1","time":"2022-04-19T19:54:47+03:00","type_url":"type.googleapis.com/envoy.config.cluster.v3.Cluster","version_info":"1"}
{"connection":2,"context":"xds","error":"context canceled","level":"error","msg":"stream terminated","node_id":"envoy-pszrb","node_version":"v1.21.1","resource_names":["default/echoserver/http"],"response_nonce":"1","time":"2022-04-19T19:54:47+03:00","type_url":"type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment","version_info":"1"}
{"connection":3,"context":"xds","error":"context canceled","level":"error","msg":"stream terminated","node_id":"envoy-pszrb","node_version":"v1.21.1","resource_names":["ingress_http"],"response_nonce":"1","time":"2022-04-19T19:54:47+03:00","type_url":"type.googleapis.com/envoy.config.route.v3.RouteConfiguration","version_info":"1"}
{"connection":4,"context":"xds","error":"context canceled","level":"error","msg":"stream terminated","node_id":"envoy-pszrb","node_version":"v1.21.1","resource_names":null,"response_nonce":"1","time":"2022-04-19T19:54:47+03:00","type_url":"type.googleapis.com/envoy.config.listener.v3.Listener","version_info":"1"} |
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.
This LGTM, we're trying to avoid adding command line flags in general, but I agree this is a good exception.
worth merging for 1.21 i think, missed the RC but not a huge change, should be easy to cherry-pick |
Signed-off-by: Tero Saarni <tero.saarni@est.tech>
Thanks @sunjayBhatia! I should have asked myself if this will still fit into the release :) |
Signed-off-by: Tero Saarni <tero.saarni@est.tech>
Signed-off-by: Tero Saarni <tero.saarni@est.tech>
This change enables Contour logs in JSON format as discussed in #4414 (comment).
The PR proposes new command line argument
--log-format
over generally preferred configuration CRD or config file field. The reasoning for new command line argument is to allow setting formatter for all sub-commands, not onlyserve
, and setting it as early as possible, before CR is fetched from the API server or before config file is read from filesystem.Fixes #4414
Signed-off-by: Tero Saarni tero.saarni@est.tech