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
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:
-management.enabledflagfilebeat.ymlProposed
-management.enabledflagmanagement.enabledflag is not set filebeat loads a config fromfilebeat.ymlotherwise use sane default configuration