From 883dbbde27b7af97536d22d9af290aaad4b39cf8 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 16 Jan 2020 10:35:07 -0800 Subject: [PATCH 01/16] Mask password is string representation of config --- metricbeat/autodiscover/builder/hints/metrics.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/metricbeat/autodiscover/builder/hints/metrics.go b/metricbeat/autodiscover/builder/hints/metrics.go index c10b39967c4a..17937da82bf9 100644 --- a/metricbeat/autodiscover/builder/hints/metrics.go +++ b/metricbeat/autodiscover/builder/hints/metrics.go @@ -56,6 +56,17 @@ type metricHints struct { Registry *mb.Register } +type moduleCfg common.MapStr + +func (mcfg *moduleCfg) String() string { + mcfgCopy := common.MapStr(*mcfg).Clone() + if exists, _ := mcfgCopy.HasKey("password"); exists { + mcfgCopy.Put("password", "******") + } + + return mcfgCopy.String() +} + // NewMetricHints builds a new metrics builder based on hints func NewMetricHints(cfg *common.Config) (autodiscover.Builder, error) { config := defaultConfig() @@ -117,7 +128,7 @@ func (m *metricHints) CreateConfig(event bus.Event) []*common.Config { username := m.getUsername(hints) password := m.getPassword(hints) - moduleConfig := common.MapStr{ + moduleConfig := moduleCfg{ "module": mod, "metricsets": msets, "hosts": hosts, From c44b87b673b086aa0839378bc33712f89e80d058 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 16 Jan 2020 10:37:18 -0800 Subject: [PATCH 02/16] Rename method --- metricbeat/autodiscover/builder/hints/metrics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metricbeat/autodiscover/builder/hints/metrics.go b/metricbeat/autodiscover/builder/hints/metrics.go index 17937da82bf9..1ef9b56026aa 100644 --- a/metricbeat/autodiscover/builder/hints/metrics.go +++ b/metricbeat/autodiscover/builder/hints/metrics.go @@ -58,7 +58,7 @@ type metricHints struct { type moduleCfg common.MapStr -func (mcfg *moduleCfg) String() string { +func (mcfg *moduleCfg) SecureString() string { mcfgCopy := common.MapStr(*mcfg).Clone() if exists, _ := mcfgCopy.HasKey("password"); exists { mcfgCopy.Put("password", "******") @@ -152,7 +152,7 @@ func (m *metricHints) CreateConfig(event bus.Event) []*common.Config { moduleConfig["password"] = password } - logp.Debug("hints.builder", "generated config: %v", moduleConfig.String()) + logp.Debug("hints.builder", "generated config: %v", moduleConfig.SecureString()) // Create config object cfg, err := common.NewConfigFrom(moduleConfig) From 227d69bed8b81e865aca8aae60808a6ca5ff5786 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 16 Jan 2020 10:42:00 -0800 Subject: [PATCH 03/16] Adding unit test --- metricbeat/autodiscover/builder/hints/metrics_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/metricbeat/autodiscover/builder/hints/metrics_test.go b/metricbeat/autodiscover/builder/hints/metrics_test.go index 1f3d37c86bf6..04c04496f405 100644 --- a/metricbeat/autodiscover/builder/hints/metrics_test.go +++ b/metricbeat/autodiscover/builder/hints/metrics_test.go @@ -324,6 +324,16 @@ func TestGenerateHints(t *testing.T) { } } +func TestModuleCfg_SecureString(t *testing.T) { + testModuleCfg := moduleCfg{ + "username": "foo", + "password": "SUPER_SECURE", + } + assert.Contains(t, testModuleCfg.SecureString(), `"username":"foo"`) + assert.Contains(t, testModuleCfg.SecureString(), `"password":"`) + assert.NotContains(t, testModuleCfg.SecureString(), "SUPER_SECURE") +} + type MockMetricSet struct { mb.BaseMetricSet } From 86d4a21266d5f1ba5aab49a49c4e499e92e97f58 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Thu, 16 Jan 2020 11:15:53 -0800 Subject: [PATCH 04/16] Use const for module config password setting name --- metricbeat/autodiscover/builder/hints/metrics.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/metricbeat/autodiscover/builder/hints/metrics.go b/metricbeat/autodiscover/builder/hints/metrics.go index 1ef9b56026aa..8794e6a81d40 100644 --- a/metricbeat/autodiscover/builder/hints/metrics.go +++ b/metricbeat/autodiscover/builder/hints/metrics.go @@ -47,6 +47,8 @@ const ( username = "username" password = "password" + mcfgPassword = "password" + defaultTimeout = "3s" defaultPeriod = "1m" ) @@ -60,8 +62,8 @@ type moduleCfg common.MapStr func (mcfg *moduleCfg) SecureString() string { mcfgCopy := common.MapStr(*mcfg).Clone() - if exists, _ := mcfgCopy.HasKey("password"); exists { - mcfgCopy.Put("password", "******") + if exists, _ := mcfgCopy.HasKey(mcfgPassword); exists { + mcfgCopy.Put(mcfgPassword, "******") } return mcfgCopy.String() @@ -149,7 +151,7 @@ func (m *metricHints) CreateConfig(event bus.Event) []*common.Config { moduleConfig["username"] = username } if password != "" { - moduleConfig["password"] = password + moduleConfig[mcfgPassword] = password } logp.Debug("hints.builder", "generated config: %v", moduleConfig.SecureString()) From 83543e992d14cd8bc730ef91e107b89b03a8d5fc Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 07:24:03 -0800 Subject: [PATCH 05/16] Using common.DebugString --- metricbeat/autodiscover/builder/hints/metrics.go | 8 ++------ metricbeat/autodiscover/builder/hints/metrics_test.go | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/metricbeat/autodiscover/builder/hints/metrics.go b/metricbeat/autodiscover/builder/hints/metrics.go index 8794e6a81d40..684c1c685816 100644 --- a/metricbeat/autodiscover/builder/hints/metrics.go +++ b/metricbeat/autodiscover/builder/hints/metrics.go @@ -61,12 +61,8 @@ type metricHints struct { type moduleCfg common.MapStr func (mcfg *moduleCfg) SecureString() string { - mcfgCopy := common.MapStr(*mcfg).Clone() - if exists, _ := mcfgCopy.HasKey(mcfgPassword); exists { - mcfgCopy.Put(mcfgPassword, "******") - } - - return mcfgCopy.String() + cfg := common.MustNewConfigFrom(mcfg) + return common.DebugString(cfg, true) } // NewMetricHints builds a new metrics builder based on hints diff --git a/metricbeat/autodiscover/builder/hints/metrics_test.go b/metricbeat/autodiscover/builder/hints/metrics_test.go index 04c04496f405..5a8b09149075 100644 --- a/metricbeat/autodiscover/builder/hints/metrics_test.go +++ b/metricbeat/autodiscover/builder/hints/metrics_test.go @@ -329,8 +329,8 @@ func TestModuleCfg_SecureString(t *testing.T) { "username": "foo", "password": "SUPER_SECURE", } - assert.Contains(t, testModuleCfg.SecureString(), `"username":"foo"`) - assert.Contains(t, testModuleCfg.SecureString(), `"password":"`) + assert.Contains(t, testModuleCfg.SecureString(), `"username": "foo"`) + assert.Contains(t, testModuleCfg.SecureString(), `"password": "`) assert.NotContains(t, testModuleCfg.SecureString(), "SUPER_SECURE") } From 96da7dc069789dc976f974cace0dab2029096cd8 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 07:31:13 -0800 Subject: [PATCH 06/16] Simplifying --- metricbeat/autodiscover/builder/hints/metrics.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/metricbeat/autodiscover/builder/hints/metrics.go b/metricbeat/autodiscover/builder/hints/metrics.go index 684c1c685816..6d9e9dda54d1 100644 --- a/metricbeat/autodiscover/builder/hints/metrics.go +++ b/metricbeat/autodiscover/builder/hints/metrics.go @@ -58,13 +58,6 @@ type metricHints struct { Registry *mb.Register } -type moduleCfg common.MapStr - -func (mcfg *moduleCfg) SecureString() string { - cfg := common.MustNewConfigFrom(mcfg) - return common.DebugString(cfg, true) -} - // NewMetricHints builds a new metrics builder based on hints func NewMetricHints(cfg *common.Config) (autodiscover.Builder, error) { config := defaultConfig() @@ -126,7 +119,7 @@ func (m *metricHints) CreateConfig(event bus.Event) []*common.Config { username := m.getUsername(hints) password := m.getPassword(hints) - moduleConfig := moduleCfg{ + moduleConfig := common.MapStr{ "module": mod, "metricsets": msets, "hosts": hosts, @@ -150,14 +143,12 @@ func (m *metricHints) CreateConfig(event bus.Event) []*common.Config { moduleConfig[mcfgPassword] = password } - logp.Debug("hints.builder", "generated config: %v", moduleConfig.SecureString()) - // Create config object cfg, err := common.NewConfigFrom(moduleConfig) if err != nil { logp.Debug("hints.builder", "config merge failed with error: %v", err) } - logp.Debug("hints.builder", "generated config: +%v", *cfg) + logp.Debug("hints.builder", "generated config: +%v", common.DebugString(cfg, true)) config = append(config, cfg) // Apply information in event to the template to generate the final config From b3900ed37032f5c62643f0a1e62c4e30fe803539 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 07:31:33 -0800 Subject: [PATCH 07/16] Removing now-invalid unit test --- metricbeat/autodiscover/builder/hints/metrics_test.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/metricbeat/autodiscover/builder/hints/metrics_test.go b/metricbeat/autodiscover/builder/hints/metrics_test.go index 5a8b09149075..1f3d37c86bf6 100644 --- a/metricbeat/autodiscover/builder/hints/metrics_test.go +++ b/metricbeat/autodiscover/builder/hints/metrics_test.go @@ -324,16 +324,6 @@ func TestGenerateHints(t *testing.T) { } } -func TestModuleCfg_SecureString(t *testing.T) { - testModuleCfg := moduleCfg{ - "username": "foo", - "password": "SUPER_SECURE", - } - assert.Contains(t, testModuleCfg.SecureString(), `"username": "foo"`) - assert.Contains(t, testModuleCfg.SecureString(), `"password": "`) - assert.NotContains(t, testModuleCfg.SecureString(), "SUPER_SECURE") -} - type MockMetricSet struct { mb.BaseMetricSet } From 2105597786dee57b7174b8221e2374889bba5900 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 07:33:01 -0800 Subject: [PATCH 08/16] Removing now-unnecessary const --- metricbeat/autodiscover/builder/hints/metrics.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/metricbeat/autodiscover/builder/hints/metrics.go b/metricbeat/autodiscover/builder/hints/metrics.go index 6d9e9dda54d1..1cfe7d941eae 100644 --- a/metricbeat/autodiscover/builder/hints/metrics.go +++ b/metricbeat/autodiscover/builder/hints/metrics.go @@ -47,8 +47,6 @@ const ( username = "username" password = "password" - mcfgPassword = "password" - defaultTimeout = "3s" defaultPeriod = "1m" ) @@ -140,7 +138,7 @@ func (m *metricHints) CreateConfig(event bus.Event) []*common.Config { moduleConfig["username"] = username } if password != "" { - moduleConfig[mcfgPassword] = password + moduleConfig["password"] = password } // Create config object From f1153726e914c74af2bdf356edd13df23e03f66e Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 10:24:13 -0800 Subject: [PATCH 09/16] Refactoring: moving debug-related var and func to common file --- libbeat/common/config.go | 36 ------------------------------------ libbeat/common/logging.go | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 36 deletions(-) create mode 100644 libbeat/common/logging.go diff --git a/libbeat/common/config.go b/libbeat/common/config.go index 7277d364f06b..af048e9ba1f1 100644 --- a/libbeat/common/config.go +++ b/libbeat/common/config.go @@ -66,18 +66,6 @@ const ( selectorConfigWithPassword = "config-with-passwords" ) -var debugBlacklist = MakeStringSet( - "password", - "passphrase", - "key_passphrase", - "pass", - "proxy_url", - "url", - "urls", - "host", - "hosts", -) - // make hasSelector and configDebugf available for unit testing var hasSelector = logp.HasSelector var configDebugf = logp.Debug @@ -392,30 +380,6 @@ func DebugString(c *Config, filterPrivate bool) string { return strings.Join(bufs, "\n") } -func filterDebugObject(c interface{}) { - switch cfg := c.(type) { - case map[string]interface{}: - for k, v := range cfg { - if debugBlacklist.Has(k) { - if arr, ok := v.([]interface{}); ok { - for i := range arr { - arr[i] = "xxxxx" - } - } else { - cfg[k] = "xxxxx" - } - } else { - filterDebugObject(v) - } - } - - case []interface{}: - for _, elem := range cfg { - filterDebugObject(elem) - } - } -} - // OwnerHasExclusiveWritePerms asserts that the current user or root is the // owner of the config file and that the config file is (at most) writable by // the owner or root (e.g. group and other cannot have write access). diff --git a/libbeat/common/logging.go b/libbeat/common/logging.go new file mode 100644 index 000000000000..c567f07ae216 --- /dev/null +++ b/libbeat/common/logging.go @@ -0,0 +1,37 @@ +package common + +var debugBlacklist = MakeStringSet( + "password", + "passphrase", + "key_passphrase", + "pass", + "proxy_url", + "url", + "urls", + "host", + "hosts", +) + +func filterDebugObject(c interface{}) { + switch cfg := c.(type) { + case map[string]interface{}: + for k, v := range cfg { + if debugBlacklist.Has(k) { + if arr, ok := v.([]interface{}); ok { + for i := range arr { + arr[i] = "xxxxx" + } + } else { + cfg[k] = "xxxxx" + } + } else { + filterDebugObject(v) + } + } + + case []interface{}: + for _, elem := range cfg { + filterDebugObject(elem) + } + } +} From 790578b97ebfe8f54c8c754d4116b8de29db349e Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 10:25:21 -0800 Subject: [PATCH 10/16] Refactoring: rename from black list to mask list --- libbeat/common/logging.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libbeat/common/logging.go b/libbeat/common/logging.go index c567f07ae216..c0116b815954 100644 --- a/libbeat/common/logging.go +++ b/libbeat/common/logging.go @@ -1,6 +1,6 @@ package common -var debugBlacklist = MakeStringSet( +var debugMasklist = MakeStringSet( "password", "passphrase", "key_passphrase", @@ -16,7 +16,7 @@ func filterDebugObject(c interface{}) { switch cfg := c.(type) { case map[string]interface{}: for k, v := range cfg { - if debugBlacklist.Has(k) { + if debugMasklist.Has(k) { if arr, ok := v.([]interface{}); ok { for i := range arr { arr[i] = "xxxxx" From 184b64f8a7e853e059d3549344520c6dcd5e9a3e Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 10:25:43 -0800 Subject: [PATCH 11/16] Implement fmt.Formatter for common.MapStr --- libbeat/common/mapstr.go | 14 ++++++++++++++ libbeat/common/mapstr_test.go | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/libbeat/common/mapstr.go b/libbeat/common/mapstr.go index ca2a31d50b39..b06a26bbbf5b 100644 --- a/libbeat/common/mapstr.go +++ b/libbeat/common/mapstr.go @@ -20,6 +20,7 @@ package common import ( "encoding/json" "fmt" + "io" "sort" "strings" @@ -234,6 +235,19 @@ func (m MapStr) MarshalLogObject(enc zapcore.ObjectEncoder) error { return nil } +// Format implements fmt.Formatter +func (m MapStr) Format(f fmt.State, c rune) { + if f.Flag('+') || f.Flag('#') { + io.WriteString(f, m.String()) + return + } + + debugM := m.Clone() + filterDebugObject(map[string]interface{}(debugM)) + + io.WriteString(f, debugM.String()) +} + // Flatten flattens the given MapStr and returns a flat MapStr. // // Example: diff --git a/libbeat/common/mapstr_test.go b/libbeat/common/mapstr_test.go index 34223344d80c..784814bdac38 100644 --- a/libbeat/common/mapstr_test.go +++ b/libbeat/common/mapstr_test.go @@ -1002,3 +1002,26 @@ func BenchmarkWalkMap(b *testing.B) { } }) } + +func TestFormat(t *testing.T) { + input := MapStr{ + "foo": "bar", + "password": "SUPER_SECURE", + } + + tests := map[string]string{ + "%v": `{"foo":"bar","password":"xxxxx"}`, + "%+v": `{"foo":"bar","password":"SUPER_SECURE"}`, + "%#v": `{"foo":"bar","password":"SUPER_SECURE"}`, + "%s": `{"foo":"bar","password":"xxxxx"}`, + "%+s": `{"foo":"bar","password":"SUPER_SECURE"}`, + "%#s": `{"foo":"bar","password":"SUPER_SECURE"}`, + } + + for verb, expected := range tests { + t.Run(verb, func(t *testing.T) { + actual := fmt.Sprintf(verb, input) + assert.Equal(t, expected, actual) + }) + } +} From e4856170cfb4f81a0a75e4f4360f6ceeb79814d0 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 10:26:01 -0800 Subject: [PATCH 12/16] Reintroduce debug statement --- metricbeat/autodiscover/builder/hints/metrics.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metricbeat/autodiscover/builder/hints/metrics.go b/metricbeat/autodiscover/builder/hints/metrics.go index 1cfe7d941eae..677b96bb1e4f 100644 --- a/metricbeat/autodiscover/builder/hints/metrics.go +++ b/metricbeat/autodiscover/builder/hints/metrics.go @@ -141,6 +141,8 @@ func (m *metricHints) CreateConfig(event bus.Event) []*common.Config { moduleConfig["password"] = password } + logp.Debug("hints.builder", "generated config: %v", moduleConfig) + // Create config object cfg, err := common.NewConfigFrom(moduleConfig) if err != nil { From 350170631c7d6935b4dd957143cec5559b98d2f5 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 10:30:56 -0800 Subject: [PATCH 13/16] Make MarshalLogObject always filter MapStr object for logging purposes --- libbeat/common/mapstr.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libbeat/common/mapstr.go b/libbeat/common/mapstr.go index b06a26bbbf5b..0e18c9a1f4f9 100644 --- a/libbeat/common/mapstr.go +++ b/libbeat/common/mapstr.go @@ -219,13 +219,16 @@ func (m MapStr) MarshalLogObject(enc zapcore.ObjectEncoder) error { return nil } - keys := make([]string, 0, len(m)) - for k := range m { + debugM := m.Clone() + filterDebugObject(map[string]interface{}(debugM)) + + keys := make([]string, 0, len(debugM)) + for k := range debugM { keys = append(keys, k) } sort.Strings(keys) for _, k := range keys { - v := m[k] + v := debugM[k] if inner, ok := tryToMapStr(v); ok { enc.AddObject(k, inner) continue From fbd3122e1fab6ea8635ee75d2dcbe4a3691e5199 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 10:32:55 -0800 Subject: [PATCH 14/16] Refactoring: renaming to be bit more generic --- libbeat/common/config.go | 4 ++-- libbeat/common/logging.go | 10 +++++----- libbeat/common/mapstr.go | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libbeat/common/config.go b/libbeat/common/config.go index af048e9ba1f1..2f779d996bbf 100644 --- a/libbeat/common/config.go +++ b/libbeat/common/config.go @@ -357,7 +357,7 @@ func DebugString(c *Config, filterPrivate bool) string { return fmt.Sprintf(" %v", err) } if filterPrivate { - filterDebugObject(content) + applyLoggingMask(content) } j, _ := json.MarshalIndent(content, "", " ") bufs = append(bufs, string(j)) @@ -368,7 +368,7 @@ func DebugString(c *Config, filterPrivate bool) string { return fmt.Sprintf(" %v", err) } if filterPrivate { - filterDebugObject(content) + applyLoggingMask(content) } j, _ := json.MarshalIndent(content, "", " ") bufs = append(bufs, string(j)) diff --git a/libbeat/common/logging.go b/libbeat/common/logging.go index c0116b815954..2ca2772ab2be 100644 --- a/libbeat/common/logging.go +++ b/libbeat/common/logging.go @@ -1,6 +1,6 @@ package common -var debugMasklist = MakeStringSet( +var maskList = MakeStringSet( "password", "passphrase", "key_passphrase", @@ -12,11 +12,11 @@ var debugMasklist = MakeStringSet( "hosts", ) -func filterDebugObject(c interface{}) { +func applyLoggingMask(c interface{}) { switch cfg := c.(type) { case map[string]interface{}: for k, v := range cfg { - if debugMasklist.Has(k) { + if maskList.Has(k) { if arr, ok := v.([]interface{}); ok { for i := range arr { arr[i] = "xxxxx" @@ -25,13 +25,13 @@ func filterDebugObject(c interface{}) { cfg[k] = "xxxxx" } } else { - filterDebugObject(v) + applyLoggingMask(v) } } case []interface{}: for _, elem := range cfg { - filterDebugObject(elem) + applyLoggingMask(elem) } } } diff --git a/libbeat/common/mapstr.go b/libbeat/common/mapstr.go index 0e18c9a1f4f9..8cf589b0f04a 100644 --- a/libbeat/common/mapstr.go +++ b/libbeat/common/mapstr.go @@ -220,7 +220,7 @@ func (m MapStr) MarshalLogObject(enc zapcore.ObjectEncoder) error { } debugM := m.Clone() - filterDebugObject(map[string]interface{}(debugM)) + applyLoggingMask(map[string]interface{}(debugM)) keys := make([]string, 0, len(debugM)) for k := range debugM { @@ -246,7 +246,7 @@ func (m MapStr) Format(f fmt.State, c rune) { } debugM := m.Clone() - filterDebugObject(map[string]interface{}(debugM)) + applyLoggingMask(map[string]interface{}(debugM)) io.WriteString(f, debugM.String()) } From 68667f0915f2b3531dc84d7d0ec55da3252e182c Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 11:06:42 -0800 Subject: [PATCH 15/16] Forgot to add license header to new file --- libbeat/common/logging.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libbeat/common/logging.go b/libbeat/common/logging.go index 2ca2772ab2be..2c5f656abd48 100644 --- a/libbeat/common/logging.go +++ b/libbeat/common/logging.go @@ -1,3 +1,20 @@ +// Licensed to Elasticsearch B.V. under one or more contributor +// license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright +// ownership. Elasticsearch B.V. licenses this file to you under +// the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + package common var maskList = MakeStringSet( From 5e8b53af7e9d17240091044631732c4c85977d09 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Fri, 17 Jan 2020 11:36:22 -0800 Subject: [PATCH 16/16] Fixing verb syntax --- metricbeat/autodiscover/builder/hints/metrics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metricbeat/autodiscover/builder/hints/metrics.go b/metricbeat/autodiscover/builder/hints/metrics.go index 677b96bb1e4f..247d30468604 100644 --- a/metricbeat/autodiscover/builder/hints/metrics.go +++ b/metricbeat/autodiscover/builder/hints/metrics.go @@ -148,7 +148,7 @@ func (m *metricHints) CreateConfig(event bus.Event) []*common.Config { if err != nil { logp.Debug("hints.builder", "config merge failed with error: %v", err) } - logp.Debug("hints.builder", "generated config: +%v", common.DebugString(cfg, true)) + logp.Debug("hints.builder", "generated config: %+v", common.DebugString(cfg, true)) config = append(config, cfg) // Apply information in event to the template to generate the final config