Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Elastic-Agent] Use default output by default #18091

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/elastic-agent/CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Make sure that the Elastic Agent connect over TLS in cloud. {pull}17843[17843]
- Moved stream.* fields to top of event {pull}17858[17858]
- Fix an issue where the checkin_frequency, jitter, and backoff options where not configurable. {pull}17843[17843]
- Use default output by default {pull}18091[18091]

==== New features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ const (
monitoringOutputFormatKey = "outputs.%s"
outputKey = "output"

enabledKey = "settings.monitoring.enabled"
outputsKey = "outputs"
elasticsearchKey = "elasticsearch"
typeKey = "type"
enabledKey = "settings.monitoring.enabled"
outputsKey = "outputs"
elasticsearchKey = "elasticsearch"
typeKey = "type"
defaultOutputName = "default"
)

func injectMonitoring(outputGroup string, rootAst *transpiler.AST, programsToRun []program.Program) ([]program.Program, error) {
Expand All @@ -40,17 +41,17 @@ func injectMonitoring(outputGroup string, rootAst *transpiler.AST, programsToRun
config[enabledKey] = false
} else {
// get monitoring output name to be used
monitoringOutputName := defaultOutputName
useOutputNode, found := transpiler.Lookup(rootAst, monitoringUseOutputKey)
if !found {
return programsToRun, nil
}
if found {

monitoringOutputNameKey, ok := useOutputNode.Value().(*transpiler.StrVal)
if !ok {
return programsToRun, nil
}
monitoringOutputNameKey, ok := useOutputNode.Value().(*transpiler.StrVal)
if !ok {
return programsToRun, nil
}

monitoringOutputName := monitoringOutputNameKey.String()
monitoringOutputName = monitoringOutputNameKey.String()
}

ast := rootAst.Clone()
if err := getMonitoringRule(monitoringOutputName).Apply(ast); err != nil {
Expand Down