@@ -25,7 +25,7 @@ import (
2525 "github.com/elastic/fleet-server/v7/internal/pkg/config"
2626 "github.com/elastic/fleet-server/v7/internal/pkg/dl"
2727 "github.com/elastic/fleet-server/v7/internal/pkg/es"
28- "github.com/elastic/fleet-server/v7/internal/pkg/logger"
28+ "github.com/elastic/fleet-server/v7/internal/pkg/logger/ecs "
2929 "github.com/elastic/fleet-server/v7/internal/pkg/model"
3030 "github.com/elastic/fleet-server/v7/internal/pkg/policy"
3131 "github.com/elastic/fleet-server/v7/internal/pkg/smap"
@@ -243,8 +243,8 @@ func (ack *AckT) handleAckEvents(ctx context.Context, zlog zerolog.Logger, agent
243243 span .Context .SetLabel ("agent_id" , agent .Agent .ID )
244244 span .Context .SetLabel ("action_id" , event .ActionId )
245245 log := zlog .With ().
246- Str (logger .ActionID , event .ActionId ).
247- Str (logger .AgentID , event .AgentId ).
246+ Str (ecs .ActionID , event .ActionId ).
247+ Str (ecs .AgentID , event .AgentId ).
248248 Time ("timestamp" , event .Timestamp ).
249249 Int ("n" , n ).Logger ()
250250 log .Info ().Msg ("ack event" )
@@ -365,14 +365,14 @@ func (ack *AckT) handleActionResult(ctx context.Context, zlog zerolog.Logger, ag
365365
366366 // Save action result document
367367 if err := dl .CreateActionResult (ctx , ack .bulk , acr ); err != nil {
368- zlog .Error ().Err (err ).Str (logger .AgentID , agent .Agent .ID ).Str (logger .ActionID , action .Id ).Msg ("create action result" )
368+ zlog .Error ().Err (err ).Str (ecs .AgentID , agent .Agent .ID ).Str (ecs .ActionID , action .Id ).Msg ("create action result" )
369369 return err
370370 }
371371
372372 if action .Type == TypeUpgrade {
373373 event , _ := ev .AsUpgradeEvent ()
374374 if err := ack .handleUpgrade (ctx , zlog , agent , event ); err != nil {
375- zlog .Error ().Err (err ).Str (logger .AgentID , agent .Agent .ID ).Str (logger .ActionID , action .Id ).Msg ("handle upgrade event" )
375+ zlog .Error ().Err (err ).Str (ecs .AgentID , agent .Agent .ID ).Str (ecs .ActionID , action .Id ).Msg ("handle upgrade event" )
376376 return err
377377 }
378378 }
@@ -397,7 +397,7 @@ func (ack *AckT) handlePolicyChange(ctx context.Context, zlog zerolog.Logger, ag
397397 Str ("agent.policyId" , agent .PolicyID ).
398398 Int64 ("agent.revisionIdx" , currRev ).
399399 Str ("rev.policyId" , rev .PolicyID ).
400- Int64 (logger .RevisionIdx , rev .RevisionIdx ).
400+ Int64 (ecs .RevisionIdx , rev .RevisionIdx ).
401401 Msg ("ack policy revision" )
402402
403403 if ok && rev .PolicyID == agent .PolicyID && rev .RevisionIdx > currRev {
@@ -446,7 +446,7 @@ func (ack *AckT) updateAPIKey(ctx context.Context,
446446 if outputName != "" {
447447 outputBulk := ack .bulk .GetBulker (outputName )
448448 if outputBulk != nil {
449- zlog .Debug ().Str (logger .PolicyOutputName , outputName ).Msg ("Using output bulker in updateAPIKey" )
449+ zlog .Debug ().Str (ecs .PolicyOutputName , outputName ).Msg ("Using output bulker in updateAPIKey" )
450450 bulk = outputBulk
451451 }
452452 }
@@ -457,14 +457,14 @@ func (ack *AckT) updateAPIKey(ctx context.Context,
457457 zlog .Warn ().
458458 Err (err ).
459459 Str (LogAPIKeyID , apiKeyID ).
460- Str (logger .PolicyOutputName , outputName ).
460+ Str (ecs .PolicyOutputName , outputName ).
461461 Msg ("Failed to read API Key roles" )
462462 } else {
463463 // race when API key was invalidated before acking
464464 zlog .Info ().
465465 Err (err ).
466466 Str (LogAPIKeyID , apiKeyID ).
467- Str (logger .PolicyOutputName , outputName ).
467+ Str (ecs .PolicyOutputName , outputName ).
468468 Msg ("Failed to read invalidated API Key roles" )
469469
470470 // prevents future checks
@@ -480,14 +480,14 @@ func (ack *AckT) updateAPIKey(ctx context.Context,
480480 Msg ("Failed to cleanup roles" )
481481 } else if removedRolesCount > 0 {
482482 if err := bulk .APIKeyUpdate (ctx , apiKeyID , permissionHash , clean ); err != nil {
483- zlog .Error ().Err (err ).RawJSON ("roles" , clean ).Str (LogAPIKeyID , apiKeyID ).Str (logger .PolicyOutputName , outputName ).Msg ("Failed to update API Key" )
483+ zlog .Error ().Err (err ).RawJSON ("roles" , clean ).Str (LogAPIKeyID , apiKeyID ).Str (ecs .PolicyOutputName , outputName ).Msg ("Failed to update API Key" )
484484 } else {
485485 zlog .Debug ().
486486 Str ("hash.sha256" , permissionHash ).
487487 Str (LogAPIKeyID , apiKeyID ).
488488 RawJSON ("roles" , clean ).
489489 Int ("removedRoles" , removedRolesCount ).
490- Str (logger .PolicyOutputName , outputName ).
490+ Str (ecs .PolicyOutputName , outputName ).
491491 Msg ("Updating agent record to pick up reduced roles." )
492492 }
493493 }
@@ -634,8 +634,8 @@ func (ack *AckT) handleUpgrade(ctx context.Context, zlog zerolog.Logger, agent *
634634 zlog .Info ().
635635 Str ("lastReportedVersion" , agent .Agent .Version ).
636636 Str ("upgradedAt" , now ).
637- Str (logger .AgentID , agent .Agent .ID ).
638- Str (logger .ActionID , event .ActionId ).
637+ Str (ecs .AgentID , agent .Agent .ID ).
638+ Str (ecs .ActionID , event .ActionId ).
639639 Msg ("ack upgrade" )
640640
641641 return nil
@@ -716,17 +716,17 @@ func invalidateAPIKeys(ctx context.Context, zlog zerolog.Logger, bulk bulk.Bulk,
716716 // read output config from .fleet-policies, not filtering by policy id as agent could be reassigned
717717 policy , err := dl .QueryOutputFromPolicy (ctx , bulk , outputName )
718718 if err != nil || policy == nil {
719- zlog .Warn ().Str (logger .PolicyOutputName , outputName ).Any ("ids" , outputIds ).Msg ("Output policy not found, API keys will be orphaned" )
719+ zlog .Warn ().Str (ecs .PolicyOutputName , outputName ).Any ("ids" , outputIds ).Msg ("Output policy not found, API keys will be orphaned" )
720720 } else {
721721 outputBulk , _ , err = bulk .CreateAndGetBulker (ctx , zlog , outputName , policy .Data .Outputs )
722722 if err != nil {
723- zlog .Warn ().Str (logger .PolicyOutputName , outputName ).Any ("ids" , outputIds ).Msg ("Failed to recreate output bulker, API keys will be orphaned" )
723+ zlog .Warn ().Str (ecs .PolicyOutputName , outputName ).Any ("ids" , outputIds ).Msg ("Failed to recreate output bulker, API keys will be orphaned" )
724724 }
725725 }
726726 }
727727 if outputBulk != nil {
728728 if err := outputBulk .APIKeyInvalidate (ctx , outputIds ... ); err != nil {
729- zlog .Info ().Err (err ).Strs ("ids" , outputIds ).Str (logger .PolicyOutputName , outputName ).Msg ("Failed to invalidate API keys" )
729+ zlog .Info ().Err (err ).Strs ("ids" , outputIds ).Str (ecs .PolicyOutputName , outputName ).Msg ("Failed to invalidate API keys" )
730730 }
731731 }
732732 }
0 commit comments