-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
VAULT-8732: Add log-file
to Vault Agent
#17841
Conversation
Name: flagNameLogFile, | ||
Target: &c.flagLogFile, | ||
EnvVar: EnvVaultLogFile, | ||
Usage: "Path to the log file that Vault should use for logging", |
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.
It's more than this though right? It can be a log dir, or a prefix: https://developer.hashicorp.com/consul/docs/agent/config/cli-flags#_log_file
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.
Shouldn't we add the other log options (like the rotation options) as well as flags? Or alternatively, since unlike consul we have logs of config without associated flags, should we maybe not add the -log-file CLI option?
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.
In Consul yes, as Consul does rotation of logs etc. so it fiddles with the name a lot more. In Vault I took the simple approach so it's no frills.
Co-authored-by: Nick Cabatoff <[email protected]>
@@ -2,10 +2,10 @@ | |||
layout: docs | |||
page_title: Commands (CLI) | |||
description: |- | |||
In addition to a verbose HTTP API, Vault features a command-line interface |
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 is a lot of (potentially unnecessary?) changes - are all of these necessary? I'm wondering if it's possible to revert the (probably automatically done by your editor) changes and keep just the ones you've added. If nothing else, we should ensure that the formatting changes don't change the contents at all!
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.
(It also makes it hard to see only the bits you've changed, so it would help for my review, too!)
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 for the catch @VioletHynes, I'm not sure why my IDE went wild with that. :(
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.
Looks good! Approved. I'm finding it hard to review the docs changes with the formatting changes added (I assume automatically by your editor), but the bits I've seen have been good.
Nice work!
Edit: Actually, the vercel deployment failed here: https://vercel.com/hashicorp/vault/4HArMN49mEzH9tMzGVfhzu1H2e3F
We should make sure to re-deploy then ensure the docs look good before merging.
This pull request will add support for Vault Agent to write log files to a specified path, it can be supplied using:
log_file
)VAULT_LOG_FILE
)-log-file
)The order of precedence follows that of other Vault parameters,
CLI > Environment variable > HCL config
.The change was modelled heavily on Consul's approach to logging, and we have employed Consul changes to Vault (in a stripped down format) to support logging to files, in order to support logging from Vault Agent when running as a Windows Service.
Documentation has been updated, but suggest that it's reviewed for style guidance.
Some manual testing to be carried out in a Windows environment before this PR is marked 'ready for review'.
Related issues: #15393