Skip to content

Commit

Permalink
x-pack/filebeat/input/{azureblobstorage,gcs,httpjson}: fix error logg…
Browse files Browse the repository at this point in the history
…ing verbs (#41042)

(cherry picked from commit 5e989b8)
  • Loading branch information
efd6 authored and mergify[bot] committed Sep 30, 2024
1 parent c02a78b commit 0b7e387
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion x-pack/filebeat/input/azureblobstorage/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/elastic/elastic-agent-libs/mapstr"
)

const jobErrString = "job with jobId %s encountered an error: %w"
const jobErrString = "job with jobId %s encountered an error: %v"

type job struct {
// client is an azure blob handle
Expand Down
2 changes: 1 addition & 1 deletion x-pack/filebeat/input/gcs/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (s *scheduler) addFailedJobs(ctx context.Context, jobs []*job) []*job {
if !jobMap[name] {
obj, err := s.bucket.Object(name).Attrs(ctx)
if err != nil {
s.log.Errorf("adding failed job %s to job list caused an error: %w", err)
s.log.Errorf("adding failed job %s to job list caused an error: %v", name, err)
continue
}

Expand Down
8 changes: 4 additions & 4 deletions x-pack/filebeat/input/httpjson/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ func (p *chainProcessor) handleEvent(ctx context.Context, msg mapstr.M) {
// we construct a new response here from each of the pagination events
err := json.NewEncoder(body).Encode(msg)
if err != nil {
p.req.log.Errorf("error processing chain event: %w", err)
p.req.log.Errorf("error processing chain event: %v", err)
return
}
response.Body = io.NopCloser(body)
Expand All @@ -589,17 +589,17 @@ func (p *chainProcessor) handleEvent(ctx context.Context, msg mapstr.M) {
n, err := p.req.processChainPaginationEvents(ctx, p.trCtx, p.pub, &response, p.idx, p.req.log)
if err != nil {
if errors.Is(err, notLogged{}) {
p.req.log.Debugf("ignored error processing chain event: %w", err)
p.req.log.Debugf("ignored error processing chain event: %v", err)
return
}
p.req.log.Errorf("error processing chain event: %w", err)
p.req.log.Errorf("error processing chain event: %v", err)
return
}
p.n += n

err = response.Body.Close()
if err != nil {
p.req.log.Errorf("error closing http response body: %w", err)
p.req.log.Errorf("error closing http response body: %v", err)
}
}

Expand Down

0 comments on commit 0b7e387

Please sign in to comment.