Skip to content

Commit

Permalink
fix dockerlogbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr committed Jan 15, 2024
1 parent 0f01b5a commit 0bdb80e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion x-pack/dockerlogbeat/pipelinemanager/libbeattools.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/elastic/beats/v7/libbeat/version"
"github.com/elastic/elastic-agent-libs/file"
"github.com/elastic/elastic-agent-libs/logp"
"github.com/elastic/elastic-agent-libs/logp/configure"
)

// load pipeline starts up a new pipeline with the given config
Expand Down Expand Up @@ -66,6 +67,16 @@ func loadNewPipeline(logOptsConfig ContainerOutputConfig, hostname string, log *
Processors: processing,
}

// Get the default/current logging configuration
// we need some defaults to be populates otherwise Unpack will
// fail
eventsLoggerCfg := logp.DefaultConfig(configure.GetEnvironment())

// Ensure the default filename is set
if eventsLoggerCfg.Files.Name == "" {
eventsLoggerCfg.Files.Name = "dockerlogbeat-events-data"
}

pipeline, err := pipeline.LoadWithSettings(
info,
pipeline.Monitors{
Expand All @@ -76,7 +87,7 @@ func loadNewPipeline(logOptsConfig ContainerOutputConfig, hostname string, log *
pipelineCfg,
func(stat outputs.Observer) (string, outputs.Group, error) {
cfg := config.Output
out, err := outputs.Load(idxMgr, info, stat, cfg.Name(), cfg.Config())
out, err := outputs.Load(idxMgr, info, stat, cfg.Name(), cfg.Config(), eventsLoggerCfg)
return cfg.Name(), out, err
},
settings,
Expand Down

0 comments on commit 0bdb80e

Please sign in to comment.