Skip to content

Commit 2522be4

Browse files
phaleksmaus
andauthored
Fix lookup issues with inputs.d fragment yml (#840)
* Fix lookup issues with inputs.d fragment yml 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: #663 * Changelog * Fix input.d path, tie to the agent Config() directory * Update CHANGELOG to reflect that the agent configuration directory is used to locate the inputs.d directory Co-authored-by: Aleksandr Maus <aleksandr.maus@elastic.co>
1 parent f3852cf commit 2522be4

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

CHANGELOG.next.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
- Allow the / char in variable names in eql and transpiler. {issue}715[715] {pull}718[718]
113113
- Fix data duplication for standalone agent on Kubernetes using the default manifest {issue-beats}31512[31512] {pull}742[742]
114114
- Agent updates will clean up unneeded artifacts. {issue}693[693] {issue}694[694] {pull}752[752]
115+
- Use the Elastic Agent configuration directory as the root of the `inputs.d` folder. {issues}663[663]
115116
- Fix a panic caused by a race condition when installing the Elastic Agent. {issues}806[806]
116117

117118
==== New features

internal/pkg/agent/application/local_mode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func newLocal(
173173
}
174174

175175
func externalConfigsGlob() string {
176-
return filepath.Join(paths.Config(), configuration.ExternalInputsPattern)
176+
return filepath.Join(paths.AgentInputsDPath(), "*.yml")
177177
}
178178

179179
// Routes returns a list of routes handled by agent.

internal/pkg/agent/application/paths/files.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const defaultAgentStateStoreYmlFile = "state.yml"
3232
// defaultAgentStateStoreFile is the file that will contain the action that can be replayed after restart encrypted.
3333
const defaultAgentStateStoreFile = "state.enc"
3434

35+
// defaultInputDPath return the location of the inputs.d.
36+
const defaultInputsDPath = "inputs.d"
37+
3538
// AgentConfigYmlFile is a name of file used to store agent information
3639
func AgentConfigYmlFile() string {
3740
return filepath.Join(Config(), defaultAgentFleetYmlFile)
@@ -82,3 +85,8 @@ func AgentStateStoreYmlFile() string {
8285
func AgentStateStoreFile() string {
8386
return filepath.Join(Home(), defaultAgentStateStoreFile)
8487
}
88+
89+
// AgentInputsDPath is directory that contains the fragment of inputs yaml for K8s deployment.
90+
func AgentInputsDPath() string {
91+
return filepath.Join(Config(), defaultInputsDPath)
92+
}

internal/pkg/agent/configuration/settings.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
package configuration
66

77
import (
8-
"path/filepath"
9-
108
"github.com/elastic/elastic-agent/internal/pkg/artifact"
119
monitoringCfg "github.com/elastic/elastic-agent/internal/pkg/core/monitoring/config"
1210
"github.com/elastic/elastic-agent/internal/pkg/core/process"
@@ -15,9 +13,6 @@ import (
1513
"github.com/elastic/elastic-agent/pkg/core/server"
1614
)
1715

18-
// ExternalInputsPattern is a glob that matches the paths of external configuration files.
19-
var ExternalInputsPattern = filepath.Join("inputs.d", "*.yml")
20-
2116
// SettingsConfig is an collection of agent settings configuration.
2217
type SettingsConfig struct {
2318
DownloadConfig *artifact.Config `yaml:"download" config:"download" json:"download"`

0 commit comments

Comments
 (0)