Skip to content

Commit

Permalink
x-pack/filebeat/input/entityanalytics - Fix log fmt
Browse files Browse the repository at this point in the history
Change logger statements to not use `%w` (which is only for
wrapping in fmt.Errorf).

Users reported seeing messages like:

    Failed to obtain some registered user data: %!w(*fmt.wrapError=&{unable to fetch users: unexpected status code: 404 body
  • Loading branch information
andrewkroh committed Apr 16, 2024
1 parent b84523d commit 10ff202
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix filestream's registry GC: registry entries are now removed from the in-memory and disk store when they're older than the set TTL {issue}36761[36761] {pull}38488[38488]
- [threatintel] MISP splitting fix for empty responses {issue}38739[38739] {pull}38917[38917]
- Prevent GCP Pub/Sub input blockage by increasing default value of `max_outstanding_messages` {issue}35029[35029] {pull}38985[38985]
- entity-analytics input: Fix format of some log messages. {pull}38990[38990]

*Heartbeat*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (f *graph) Users(ctx context.Context, deltaLink string) ([]*fetcher.User, s
for _, v := range response.Users {
user, err := newUserFromAPI(v)
if err != nil {
f.logger.Errorf("Unable to parse user from API: %w", err)
f.logger.Errorw("Unable to parse user from API", "error", err)
continue
}
f.logger.Debugf("Got user %q from API", user.ID)
Expand Down Expand Up @@ -258,7 +258,7 @@ func (f *graph) Devices(ctx context.Context, deltaLink string) ([]*fetcher.Devic
for _, v := range response.Devices {
device, err := newDeviceFromAPI(v)
if err != nil {
f.logger.Errorf("Unable to parse device from API: %w", err)
f.logger.Errorw("Unable to parse device from API", "error", err)
continue
}
f.logger.Debugf("Got device %q from API", device.ID)
Expand Down Expand Up @@ -290,7 +290,7 @@ func (f *graph) addRegistered(ctx context.Context, device *fetcher.Device, typ s
switch {
case err == nil, errors.Is(err, nextLinkLoopError{"users"}), errors.Is(err, missingLinkError{"users"}):
default:
f.logger.Errorf("Failed to obtain some registered user data: %w", err)
f.logger.Errorw("Failed to obtain some registered user data", "error", err)
}
for _, u := range users {
set.Add(u.ID)
Expand Down

0 comments on commit 10ff202

Please sign in to comment.