diff --git a/internal/pkg/agent/application/paths/files.go b/internal/pkg/agent/application/paths/files.go index 7d35549e840..0376053ac5d 100644 --- a/internal/pkg/agent/application/paths/files.go +++ b/internal/pkg/agent/application/paths/files.go @@ -32,6 +32,9 @@ const defaultAgentStateStoreYmlFile = "state.yml" // defaultAgentStateStoreFile is the file that will contain the action that can be replayed after restart encrypted. const defaultAgentStateStoreFile = "state.enc" +// defaultInputDPath return the location of the inputs.d. +const defaultInputsDPath = "inputs.d" + // AgentConfigYmlFile is a name of file used to store agent information func AgentConfigYmlFile() string { return filepath.Join(Config(), defaultAgentFleetYmlFile) @@ -82,3 +85,8 @@ func AgentStateStoreYmlFile() string { func AgentStateStoreFile() string { return filepath.Join(Home(), defaultAgentStateStoreFile) } + +// AgentInputsDPath is directory that contains the fragment of inputs yaml for K8s deployment. +func AgentInputsDPath() string { + return filepath.Join(Home(), defaultInputsDPath) +} diff --git a/internal/pkg/agent/configuration/settings.go b/internal/pkg/agent/configuration/settings.go index 93ef491670f..cb63ab30235 100644 --- a/internal/pkg/agent/configuration/settings.go +++ b/internal/pkg/agent/configuration/settings.go @@ -7,6 +7,7 @@ package configuration import ( "path/filepath" + "github.com/elastic/elastic-agent/internal/pkg/agent/application/paths" "github.com/elastic/elastic-agent/internal/pkg/artifact" monitoringCfg "github.com/elastic/elastic-agent/internal/pkg/core/monitoring/config" "github.com/elastic/elastic-agent/internal/pkg/core/process" @@ -16,7 +17,7 @@ import ( ) // ExternalInputsPattern is a glob that matches the paths of external configuration files. -var ExternalInputsPattern = filepath.Join("inputs.d", "*.yml") +var ExternalInputsPattern = filepath.Join(paths.AgentInputsDPath(), "*.yml") // SettingsConfig is an collection of agent settings configuration. type SettingsConfig struct {