Skip to content

Commit

Permalink
Remove telegraf agent start up. (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
jefchien authored and Andrew Huynh committed Jul 27, 2023
1 parent 4c7abf4 commit 3f60a57
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cmd/amazon-cloudwatch-agent/amazon-cloudwatch-agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,18 +296,21 @@ func runAgent(ctx context.Context,
}

if len(c.Inputs) != 0 && len(c.Outputs) != 0 {
log.Println("creating new logs agent")
logAgent := logs.NewLogAgent(c)
log.Println("I! Creating new logs agent")
// Always run logAgent as goroutine regardless of whether starting OTEL or Telegraf.
go logAgent.Run(ctx)
logAgent := logs.NewLogAgent(c)

// If OTEL config does not exist, then ASSUME just monitoring logs.
// So just start Telegraf.
_, err = os.Stat(*fOtelConfig)
if errors.Is(err, os.ErrNotExist) {
agentinfo.SetComponents(&otelcol.Config{}, c)
return ag.Run(ctx)
log.Println("I! Only starting logs agent")
logAgent.Run(ctx)
return nil
}

go logAgent.Run(ctx)
}
// Else start OTEL and rely on adapter package to start the logfile plugin.

Expand Down

0 comments on commit 3f60a57

Please sign in to comment.