Skip to content

Commit

Permalink
Revert "Revert "Fix log level value reported by Agent to Fleet (elast…
Browse files Browse the repository at this point in the history
…ic#4838)" (elastic#4938)"

This reverts commit 2b2e8d0.
  • Loading branch information
pchila committed Jun 17, 2024
1 parent c929f79 commit f8b1a52
Show file tree
Hide file tree
Showing 3 changed files with 279 additions and 128 deletions.
4 changes: 4 additions & 0 deletions internal/pkg/agent/application/gateway/fleet/fleet_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ func (f *FleetGateway) execute(ctx context.Context) (*fleetapi.CheckinResponse,
// convert components into checkin components structure
components := f.convertToCheckinComponents(state.Components)

f.log.Debugf("correcting agent loglevel from %s to %s using coordinator state", ecsMeta.Elastic.Agent.LogLevel, state.LogLevel.String())
// Fix loglevel with the current log level used by coordinator
ecsMeta.Elastic.Agent.LogLevel = state.LogLevel.String()

// checkin
cmd := fleetapi.NewCheckinCmd(f.agentInfo, f.client)
req := &fleetapi.CheckinRequest{
Expand Down
4 changes: 4 additions & 0 deletions internal/pkg/agent/application/info/agent_metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ func TestECSMetadata(t *testing.T) {
metadata, err := agentInfo.ECSMetadata(l)
require.NoError(t, err)

if assert.NotNil(t, metadata.Elastic, "metadata.Elastic must not be nil") {
assert.NotNil(t, metadata.Elastic.Agent, "metadata.Elastic.Agent must not be nil")
}

sysInfo, err := sysinfo.Host()
require.NoError(t, err)

Expand Down
Loading

0 comments on commit f8b1a52

Please sign in to comment.