If running the Vault Agent on Windows as a service, how do I redirect the log to a file?
I found this issue here - It said this was addressed in a PR in consul-template in November.
I’ve downloaded the latest Vault agent binary for Windows, and it ignores a “-log-file” cmdline option, and it ignores a stanza like this in my vault-agent.hcl
path = "./vault-agent.log"
Ugh - for some reason I thought this was addressed in Vault, but it appears to be in an entirely different product?
I’ve still got the question - how do I get Vault agent logs somewhere if I run it as a service on Windows.
I agree, this feels like a much-needed feature. I can’t locate anything in Windows Event Viewer either.
Update - some Windows magic can redirect standard output to a file. So creating the service like this will do it (capturing both standard out, 1, and errors, 2, in the same file).
sc.exe create VaultAgent binPath= "vault.exe agent -config=vault-agent.hcl -log-level=DEBUG 1>> agent.log 2>&1" displayName= "VaultAgent" start= auto