-
Notifications
You must be signed in to change notification settings - Fork 324
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
Allow JSON logging for consul-k8s #516
Comments
Thanks for the well-described issue @paksu. We'll see if other folks in the community need this as well and prioritize as needed. |
Another setting that could be passed along with the log format would be the log level, currently there is no way to control the log level of the sidecar. |
+1, would make it easier to query the logs as well. |
Are you referring to the envoy sidecar log level? You can control the log level with an annotation or a helm value. |
@ishustava Nope, I'm talking about the Now anything that the consul-sidecar logs look like this in GCP Cloud Logging. Loglevel is So I'm asking for a way to a) configure JSON logging so log level gets parser correctly or b) a way to configure minimum log level so we would only log errors and the |
Got it, thanks for clarifying! |
Hi @paksu and @kasper thank you for your feedback. Would the expectation be to expose JSON logging format via Consul Helm as a global setting for all logs? I would think that would be something you would want to set once for all components. @paksu Could also open up another issue to track log level of sidecar? I assume you are looking to do this on a per sidecar basis as opposed to globally configuring |
Hi @david-yu I think having a global control would make sense. When running consul on GKE I have hard time figuring out why someone would want different logging formats from individual services/containers. I'll create a separate issue for the log level! Being able to control that at the sidecar level makes sense, basically allowing the same kind of control that you have for individual envoy sidecars. |
Is your feature request related to a problem? Please describe.
This is both a problem and a feature request IMO.
We are running consul connect mesh in our GKE cluster and we inject the consul sidecars in each pod of our service. Our service logs in JSON but the
consul-k8s
logs in default go-hclog format. This translates into log level ERROR in stackdriver even when the logs are info or debug. This creates additional noise to logs of every pod in our services and it's hard to see what are errors and what are not errors.Naturally you could get around this by restricting the
consul-k8s
log level to warnings or errors but IMO it would better to try to be compatible with Stackdriver and preserve original log level.Feature Description
To have better compatibility with Stackdriver you could enable configuring the
consul-k8s
log format to be JSON. This seems to be already supported bygo-hclog
but there is no way to pass the parameter to the library.Use Case(s)
Enabing Stackdriver to parse logs (when they are JSON) should improve the life of the users of Consul Connect.
Contributions
I'm not a very good go developer but with guidance I could take a stab at this. I think this also requires a change in https://github.com/hashicorp/consul-helm to be able to pass log format setting in the first place.
The text was updated successfully, but these errors were encountered: