diff --git a/internal/config/config.go b/internal/config/config.go index fe8cac5ae..4c6ed5624 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -519,7 +519,13 @@ func (c *Config) LoadDirectory(path string) error { log.Printf("W! Telegraf is not permitted to read %s", thispath) return nil } + if info.IsDir() { + if strings.HasPrefix(info.Name(), "..") { + // skip Kubernetes mounts, prevening loading the same config twice + return filepath.SkipDir + } + return nil } name := info.Name() diff --git a/internal/config/testdata/subconfig/..4984_10_04_08_28_06.119/invalid-config.conf b/internal/config/testdata/subconfig/..4984_10_04_08_28_06.119/invalid-config.conf new file mode 100644 index 000000000..aee9abdfe --- /dev/null +++ b/internal/config/testdata/subconfig/..4984_10_04_08_28_06.119/invalid-config.conf @@ -0,0 +1,4 @@ +# This invalid config file should be skipped during testing +# as it is an ..data folder + +[[outputs.influxdb