Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.16](backport #4181) Prevent mapping explosion on logs #4198

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions internal/pkg/api/handleCheckin.go
Original file line number Diff line number Diff line change
Expand Up @@ -999,14 +999,13 @@ func parseComponents(zlog zerolog.Logger, agent *model.Agent, req *CheckinReques
// Compare the deserialized meta structures and return the bytes to update if different
if !reflect.DeepEqual(reqComponents, agent.Components) {

reqComponentsJSON, _ := json.Marshal(*req.Components)
zlog.Trace().
RawJSON("oldComponents", agentComponentsJSON).
RawJSON("newComponents", *req.Components).
Str("oldComponents", string(agentComponentsJSON)).
Str("req.Components", string(reqComponentsJSON)).
Msg("local components data is not equal")

zlog.Info().
RawJSON("req.Components", *req.Components).
Msg("applying new components data")
zlog.Info().Msg("applying new components data")

outComponents = *req.Components
compUnhealthyReason := calcUnhealthyReason(reqComponents)
Expand Down
16 changes: 4 additions & 12 deletions internal/pkg/server/fleet.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,25 +251,17 @@ func configCacheChanged(curCfg, newCfg *config.Config) bool {
return curCfg.Inputs[0].Cache != newCfg.Inputs[0].Cache
}

func configChangedServer(log zerolog.Logger, curCfg, newCfg *config.Config) bool {
zlog := log.With().Interface("new", newCfg.Redact()).Logger()

func configChangedServer(zlog zerolog.Logger, curCfg, newCfg *config.Config) bool {
changed := true
switch {
case curCfg == nil:
zlog.Info().Msg("initial server configuration")
case !reflect.DeepEqual(curCfg.Fleet.CopyNoLogging(), newCfg.Fleet.CopyNoLogging()):
zlog.Info().
Interface("old", curCfg.Redact()).
Msg("fleet configuration has changed")
zlog.Info().Msg("fleet configuration has changed")
case !reflect.DeepEqual(curCfg.Output, newCfg.Output):
zlog.Info().
Interface("old", curCfg.Redact()).
Msg("output configuration has changed")
zlog.Info().Msg("output configuration has changed")
case !reflect.DeepEqual(curCfg.Inputs[0].Server, newCfg.Inputs[0].Server):
zlog.Info().
Interface("old", curCfg.Redact()).
Msg("server configuration has changed")
zlog.Info().Msg("server configuration has changed")
default:
changed = false
}
Expand Down
Loading