Skip to content

Commit

Permalink
Fix bug when merging logging configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr committed Jan 17, 2024
1 parent c8b51e4 commit 39fcc34
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libbeat/cmd/instance/beat.go
Original file line number Diff line number Diff line change
Expand Up @@ -804,9 +804,15 @@ func (b *Beat) configure(settings Settings) error {
return fmt.Errorf("error unpacking config data: %w", err)
}

// If either b.Config.EventLoggingor b.Config.Logging are nil
// merging them will fail, so in case any of them is nil,
// we set them to an empty config.C
if b.Config.EventLogging == nil {
b.Config.EventLogging = config.NewConfig()
}
if b.Config.Logging == nil {
b.Config.Logging = config.NewConfig()
}
if err := b.Config.EventLogging.Merge(b.Config.Logging); err != nil {
return fmt.Errorf("cannot merge logging and logging.events configuration: %w", err)
}
Expand Down

0 comments on commit 39fcc34

Please sign in to comment.