Skip to content

Beats run under agent should start without reading a configuration file from disk. #31901

@cmacknz

Description

@cmacknz

For compatibility with the V2 agent control protocol, beats run under agent should start without loading a configuration file from disk. Preferably a beat run under agent should start, establish a V2 control protocol client, and wait for an initial configuration from the agent.

This issue is cloned from @michalpristas's original comment in the V1 protocol removal issue: elastic/elastic-agent-client#32 (comment)

Beats behaviour change

Current

At the moment we handle process as this:

  • elastic agent starts
  • elastic agent is notified about or detects config change
  • elastic agent creates a specific change for specific beats (let's assume filebeat from now on)
  • elastic agent starts filebeat process with -management.enabled flag
  • filebeat process starts
  • filebeat loads a config from filebeat.yml
	cfg, err := cfgfile.Load("", settings.ConfigOverrides)
	if err != nil {
		return fmt.Errorf("error loading config file: %w", err)
	}
  • filebeat initializes manager to get comms with agent going
	// initialize config manager
	b.Manager, err = management.Factory(b.Config.Management)(b.Config.Management, reload.Register, b.Beat.Info.ID)
	if err != nil {
		return err
	}
  • filebeat fetches config from fleet

Proposed

  • elastic agent starts
  • elastic agent is notified about or detects config change
  • elastic agent creates a specific change for specific beats (let's assume filebeat from now on)
  • elastic agent starts filebeat process with -management.enabled flag
  • filebeat process starts
  • in case management.enabled flag is not set filebeat loads a config from filebeat.yml otherwise use sane default configuration
	cfg, err := cfgfile.Load("", settings.ConfigOverrides)
	if err != nil {
		return fmt.Errorf("error loading config file: %w", err)
	}
  • filebeat initializes manager to get comms with agent going
	// initialize config manager
	b.Manager, err = management.Factory(b.Config.Management)(b.Config.Management, reload.Register, b.Beat.Info.ID)
	if err != nil {
		return err
	}
  • filebeat fetches config from fleet2

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions