diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index b1f7c0d63bc5..27107206b32b 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -35,6 +35,7 @@ - Fixed fetching DBus service PID {pull}23496[23496] - Fix issue of missing log messages from filebeat monitor {pull}23514[23514] - Increase checkin grace period to 30 seconds {pull}23568[23568] +- Fix libbeat from reporting back degraded on config update {pull}23537[23537] ==== New features diff --git a/x-pack/elastic-agent/pkg/core/monitoring/beats/beats_monitor.go b/x-pack/elastic-agent/pkg/core/monitoring/beats/beats_monitor.go index 19298aef69ca..5944afa4f0cc 100644 --- a/x-pack/elastic-agent/pkg/core/monitoring/beats/beats_monitor.go +++ b/x-pack/elastic-agent/pkg/core/monitoring/beats/beats_monitor.go @@ -144,7 +144,12 @@ func (b *Monitor) Cleanup(spec program.Spec, pipelineID string) error { // Prepare executes steps in order for monitoring to work correctly func (b *Monitor) Prepare(spec program.Spec, pipelineID string, uid, gid int) error { - takeOwnership := b.ownLoggingPath(spec) + if !b.ownLoggingPath(spec) { + // spec file passes a log path; so its up to the application to ensure the + // path exists and the write permissions are set so Elastic Agent can read it + return nil + } + drops := []string{b.generateLoggingPath(spec, pipelineID)} if drop := b.monitoringDrop(spec, pipelineID); drop != "" { drops = append(drops, drop) @@ -167,10 +172,8 @@ func (b *Monitor) Prepare(spec program.Spec, pipelineID string, uid, gid int) er } } - if takeOwnership { - if err := changeOwner(drop, uid, gid); err != nil { - return err - } + if err := changeOwner(drop, uid, gid); err != nil { + return err } } diff --git a/x-pack/elastic-agent/pkg/core/plugin/process/status.go b/x-pack/elastic-agent/pkg/core/plugin/process/status.go index eac8f2bc53e5..473ae9a70c77 100644 --- a/x-pack/elastic-agent/pkg/core/plugin/process/status.go +++ b/x-pack/elastic-agent/pkg/core/plugin/process/status.go @@ -35,9 +35,6 @@ func (a *Application) OnStatusChange(s *server.ApplicationState, status proto.St return } - // it was a crash, cleanup anything required - go a.cleanUp() - // kill the process if a.state.ProcessInfo != nil { _ = a.state.ProcessInfo.Process.Kill() diff --git a/x-pack/libbeat/management/fleet/manager.go b/x-pack/libbeat/management/fleet/manager.go index dc0185a04ace..8aec0af1800b 100644 --- a/x-pack/libbeat/management/fleet/manager.go +++ b/x-pack/libbeat/management/fleet/manager.go @@ -169,7 +169,7 @@ func (cm *Manager) OnConfig(s string) { if errs := cm.apply(blocks); !errs.IsEmpty() { // `cm.apply` already logs the errors; currently allow beat to run degraded - cm.UpdateStatus(management.Degraded, errs.Error()) + cm.UpdateStatus(management.Failed, errs.Error()) return }