Skip to content

Commit

Permalink
Fix lookup issues with inputs.d fragment yml
Browse files Browse the repository at this point in the history
The Elastic Agent was looking next to the binary for the `inputs.d`
folder instead it should look up into the `Home` folder where
the Elastic Agent symlink is located.

Fixes: elastic#663
  • Loading branch information
ph committed Aug 2, 2022
1 parent 74ce2ba commit 35ad85b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions internal/pkg/agent/application/paths/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion internal/pkg/agent/configuration/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down

0 comments on commit 35ad85b

Please sign in to comment.