From 86d4f98ddc2dd81f484d41dc65de89263c77f757 Mon Sep 17 00:00:00 2001 From: hc-github-team-secure-vault-core <82990506+hc-github-team-secure-vault-core@users.noreply.github.com> Date: Wed, 8 Nov 2023 05:01:32 -0500 Subject: [PATCH] Backport of fix `log_requests_level` misconfiguration into release/1.14.x (#24058) * backport of commit 0f5f648c1c9505e975ea2d479aa5e9f27bb1d935 * changelog --------- Co-authored-by: Peter Wilson --- changelog/24058.txt | 3 +++ vault/core.go | 8 ++++---- vault/core_test.go | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 changelog/24058.txt diff --git a/changelog/24058.txt b/changelog/24058.txt new file mode 100644 index 000000000..baa7fa98b --- /dev/null +++ b/changelog/24058.txt @@ -0,0 +1,3 @@ +```release-note:bug +core/config: Use correct HCL config value when configuring `log_requests_level`. +``` \ No newline at end of file diff --git a/vault/core.go b/vault/core.go index 54999443c..b1bd45ff0 100644 --- a/vault/core.go +++ b/vault/core.go @@ -1238,8 +1238,8 @@ func NewCore(conf *CoreConfig) (*Core, error) { return nil, err } - // Log level - c.configureLogRequestLevel(conf.RawConfig.LogLevel) + // Log requests level + c.configureLogRequestsLevel(conf.RawConfig.LogRequestsLevel) // Quotas quotasLogger := conf.Logger.Named("quotas") @@ -1303,8 +1303,8 @@ func (c *Core) configureListeners(conf *CoreConfig) error { return nil } -// configureLogRequestLevel configures the Core with the supplied log level. -func (c *Core) configureLogRequestLevel(level string) { +// configureLogRequestsLevel configures the Core with the supplied log requests level. +func (c *Core) configureLogRequestsLevel(level string) { c.logRequestsLevel = uberAtomic.NewInt32(0) lvl := log.LevelFromString(level) diff --git a/vault/core_test.go b/vault/core_test.go index 2e442417a..532f713d2 100644 --- a/vault/core_test.go +++ b/vault/core_test.go @@ -254,12 +254,12 @@ func TestNewCore_configureLogRequestLevel(t *testing.T) { t.Run(name, func(t *testing.T) { t.Parallel() - // We need to supply a logger, as configureLogRequestLevel emits + // We need to supply a logger, as configureLogRequestsLevel emits // warnings to the logs in certain circumstances. core := &Core{ logger: corehelpers.NewTestLogger(t), } - core.configureLogRequestLevel(tc.level) + core.configureLogRequestsLevel(tc.level) require.Equal(t, tc.expectedLevel, log.Level(core.logRequestsLevel.Load())) }) }