diff --git a/pkg/aggregator/demultiplexer_agent.go b/pkg/aggregator/demultiplexer_agent.go index dde62b4898074..8106e3bd9b6c4 100644 --- a/pkg/aggregator/demultiplexer_agent.go +++ b/pkg/aggregator/demultiplexer_agent.go @@ -111,6 +111,7 @@ type forwarders struct { orchestrator forwarder.Forwarder eventPlatform epforwarder.EventPlatformForwarder containerLifecycle *forwarder.DefaultForwarder + containerImage *forwarder.DefaultForwarder } type dataOutputs struct { @@ -239,6 +240,7 @@ func initAgentDemultiplexer(options AgentDemultiplexerOptions, hostname string) orchestrator: orchestratorForwarder, eventPlatform: eventPlatformForwarder, containerLifecycle: containerLifecycleForwarder, + containerImage: containerImageForwarder, }, sharedSerializer: sharedSerializer, @@ -318,6 +320,15 @@ func (d *AgentDemultiplexer) Run() { log.Debug("not starting the container lifecycle forwarder") } + // container image forwarder + if d.forwarders.containerImage != nil { + if err := d.forwarders.containerImage.Start(); err != nil { + log.Errorf("error starting container image forwarder: %v", err) + } + } else { + log.Debug("no starting the container image forwarder") + } + // shared forwarder if d.forwarders.shared != nil { d.forwarders.shared.Start() //nolint:errcheck @@ -430,6 +441,10 @@ func (d *AgentDemultiplexer) Stop(flush bool) { d.dataOutputs.forwarders.containerLifecycle.Stop() d.dataOutputs.forwarders.containerLifecycle = nil } + if d.dataOutputs.forwarders.containerImage != nil { + d.dataOutputs.forwarders.containerImage.Stop() + d.dataOutputs.forwarders.containerImage = nil + } if d.dataOutputs.forwarders.shared != nil { d.dataOutputs.forwarders.shared.Stop() d.dataOutputs.forwarders.shared = nil