Vault custom plugin output logging only visible if server in debug log-level

1,168 views
Skip to first unread message

Sebastian Ostrowski

unread,
Jul 18, 2018, 4:18:47 PM7/18/18
to Vault
Hello,

We have a plugin which outputs some logging statements using hclog, e.g.

hclog.Default().Info("request: ")

This does not show up in Vault log file unless vault server is running in debug log-level. When this is enabled, the log output looks like this:


2018-07-11T13:01:39.664-0500 [DEBUG] secrets.plugin.plugin_709b84ca.vault-nsqauth.vault-nsqauth: 2018-07-11T13:01:39.664-0500 [INFO ] Adding token WXkJjEIa4enurAfqEbLEDgvmPHJaFZpoHc9LymnsZGgqOk0ZvUZe2ZNRPiavSp3Y for topics: fb_post


You can see in above example the plugin logs with INFO level, but Vault only outputs these if running with log-level set to debug.
Is there a way to get Vault to log these normally without running the server in debug?

Brian Kassouf

unread,
Jul 18, 2018, 4:33:16 PM7/18/18
to vault...@googlegroups.com
Hi,

We provide a logger that is setup to correctly send the logs back to
the vault process. The framework.Backend function exposes it.
Calling hclog.Default() will create a new logger that doesn't know how
to properly send logs to Vault.

See https://github.com/hashicorp/vault-plugin-secrets-kv/blob/master/upgrade.go#L42
for an example.

Best,
Brian
> --
> This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/hashicorp/vault/issues
> IRC: #vault-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups "Vault" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vault-tool+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vault-tool/c1d6dc28-6bbe-46c9-9e14-1c21ebea719f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Sebastian Ostrowski

unread,
Jul 18, 2018, 4:44:09 PM7/18/18
to Vault
That works, thank you Brian!

mtha...@grepruby.com

unread,
Sep 13, 2018, 6:08:43 AM9/13/18
to Vault
How can we customize log pattern using framework.Backend.Logger ?
Reply all
Reply to author
Forward
0 new messages