-
Notifications
You must be signed in to change notification settings - Fork 173
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
Configurable default log_level and log_format for injected Vault Agent containers #417
Comments
Actually, the annotation isn't working either - when |
/kind bug |
Hi @itspngu, when I set Regardless, you should open an issue on the vault repo for issues with agent logging format. There's been some discussion over there about it recently: hashicorp/vault#18081 |
Being able to set the default log level and format for injected agents would be good to have. I think we'd probably want to add a couple new flags and env variables, probably something like vault-k8s/subcommand/injector/flags.go Line 136 in 5827448
The names of the environment variables for the setting gets a little more complicated, since there are already AGENT_INJECT_LOG_LEVEL and AGENT_INJECT_LOG_FORMAT for the injector service itself. |
You're right, I didn't look at it for long enough to realize that it's only messages of If we can find names for the proposed environment variables (or skip them and just opt for CLI flags), I'd happily implement this and put it up for review. If I were to be nitpicky, I'd say that the |
We experience this very issue and it is a bit annoying as it produces a lot of logs that have no value. For clarity, in the end we want to use In our case I configured the agent log level and log format using annotations on the workload being injected:
and this is the snipped output:
I would expect everything to be in JSON, including the |
Any updates on this issue or if it was consumed as a fix in another deployment or release? |
Is your feature request related to a problem? Please describe.
While it is possible to configure the log level & format for the injector deployment itself using the command line or environment variables, and configuring the log level
& formatfor injected Vault Agent sidecars on a per-pod basis using annotations, there is no way to configure a default log level & format for injected Vault Agent sidecars globally (e.g. setting the log format of all injected Vault Agent containers tojson
instead ofdefault
unless explicitly specified otherwise in the per-pod annotation).Describe the solution you'd like
Add a means to override the defaults for injected Vault Agent containers' log level and format instead of hardcoding them to
info
anddefault
.Describe alternatives you've considered
Using the per-pod annotations to configure these settings is,
albeit a working solution,getting cumbersome once you have a lot of workloads relying on Vault Agent. Addingvault.hashicorp.com/log-format: "json"
yieldsis supposed to yield the needed result of getting JSON log output from the Agent containers, but having to do so in dozens of places (regardless of whether it's manually or through automation) instead of being able to configure the injector accordingly feels like a missing feature.Additional context
If I understand the code correctly, these 2 lines are the culprit: https://github.com/hashicorp/vault-k8s/blob/main/agent-inject/agent/agent.go#L378-L379
Edited: Only the
vault.hashicorp.com/log-level
annotation works,vault.hashicorp.com/log-format
appears to have no effect, so this is actually a bug report on top of a feature request.The text was updated successfully, but these errors were encountered: