Skip to content

Commit 00b1bfe

Browse files
mauri870mergify[bot]
authored andcommitted
chore: fix formatting issues in logp printf-style calls (#45944)
* fix go vet errors for logp formatting issues * chore: fix formatting for logp calls * revert elastic-agent-libs bump * Apply suggestions from code review Co-authored-by: Tiago Queiroz <[email protected]> --------- Co-authored-by: Tiago Queiroz <[email protected]> Co-authored-by: Blake Rouse <[email protected]> (cherry picked from commit a5be2a8) # Conflicts: # metricbeat/module/kubernetes/util/kubernetes.go # x-pack/filebeat/input/awss3/sqs_s3_event.go
1 parent bf27bf2 commit 00b1bfe

File tree

58 files changed

+105
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+105
-91
lines changed

auditbeat/helper/hasher/cached_hasher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (ch *CachedHasher) HashFile(path string) (map[HashType]Digest, error) {
126126
entry := hashEntry{hashes: hashes, statx: statx}
127127
if ch.hashLRU.Add(path, entry) {
128128
ch.stats.Evictions++
129-
ch.log.Debugf("evict (%s)")
129+
ch.log.Debugf("evict (%s)", path)
130130
}
131131

132132
ch.log.Debugf("miss (%s) took %v", path, time.Since(x))

auditbeat/module/auditd/audit_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ func (ms *MetricSet) updateKernelLostMetric(lost uint32) {
442442
}
443443
logFn("kernel lost events: %d (total: %d)", delta, lost)
444444
} else {
445-
ms.log.Warnf("kernel lost event counter reset from %d to %d", ms.kernelLost, lost)
445+
ms.log.Warnf("kernel lost event counter reset from %d to %d", ms.kernelLost.counter, lost)
446446
}
447447
ms.kernelLost.counter = lost
448448
}

filebeat/autodiscover/builder/hints/logs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (l *logHints) CreateConfig(event bus.Event, options ...ucfg.Option) []*conf
160160
// Merge config template with the configs from the annotations
161161
// AppendValues option is used to append arrays from annotations to existing arrays while merging
162162
if err := config.MergeWithOpts(tempCfg, ucfg.AppendValues); err != nil {
163-
l.log.Debugf("hints.builder", "config merge failed with error: %v", err)
163+
l.log.Debugf("config merge failed with error: %v", err)
164164
continue
165165
}
166166
module := l.getModule(hints)
@@ -191,11 +191,11 @@ func (l *logHints) CreateConfig(event bus.Event, options ...ucfg.Option) []*conf
191191
moduleConf[fileset+".enabled"] = cfg.Enabled
192192
moduleConf[fileset+".input"] = filesetConf
193193

194-
l.log.Debugf("hints.builder", "generated config %+v", moduleConf)
194+
l.log.Debugf("generated config %+v", moduleConf)
195195
}
196196
config, _ = conf.NewConfigFrom(moduleConf)
197197
}
198-
l.log.Debugf("hints.builder", "generated config %+v of logHints %+v", config, l)
198+
l.log.Debugf("generated config %+v of logHints %+v", config, l)
199199
configs = append(configs, config)
200200
}
201201
// Apply information in event to the template to generate the final config

filebeat/input/filestream/copytruncate_prospector.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func (p *copyTruncateFileProspector) onFSEvent(
280280

281281
err := updater.ResetCursor(src, state{Offset: 0})
282282
if err != nil {
283-
log.Errorf("failed to reset file cursor: %w", err)
283+
log.Errorf("failed to reset file cursor: %v", err)
284284
}
285285
group.Restart(ctx, src)
286286

filebeat/input/filestream/filestream.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (f *logFile) startFileMonitoringIfNeeded() {
142142
return nil
143143
})
144144
if err != nil {
145-
f.log.Errorf("failed to start file monitoring: %w", err)
145+
f.log.Errorf("failed to start file monitoring: %v", err)
146146
}
147147
}
148148

@@ -152,7 +152,7 @@ func (f *logFile) startFileMonitoringIfNeeded() {
152152
return nil
153153
})
154154
if err != nil {
155-
f.log.Errorf("failed to schedule a file close: %w", err)
155+
f.log.Errorf("failed to schedule a file close: %v", err)
156156
}
157157
}
158158
}

filebeat/input/filestream/internal/input-logfile/harvester.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (hg *defaultHarvesterGroup) Start(ctx inputv2.Context, src Source) {
140140

141141
if err := hg.tg.Go(startHarvester(ctx, hg, src, false, hg.metrics)); err != nil {
142142
ctx.Logger.Warnf(
143-
"tried to start harvester with task group already closed",
143+
"tried to start harvester for %s with task group already closed",
144144
ctx.ID)
145145
}
146146
}

filebeat/input/filestream/internal/input-logfile/publish.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (op *updateOp) Execute(store *store, n uint) {
134134
} else {
135135
err := typeconv.Convert(&resource.cursor, op.delta)
136136
if err != nil {
137-
store.log.Errorf("failed to perform type conversion: %w", err)
137+
store.log.Errorf("failed to perform type conversion: %v", err)
138138
}
139139
}
140140

filebeat/input/filestream/internal/input-logfile/update_writer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func newUpdateWriter(store *store, ch *updateChan) *updateWriter {
6666
return nil
6767
})
6868
if err != nil {
69-
store.log.Errorf("failed to schedule the update writer routine: %w", err)
69+
store.log.Errorf("failed to schedule the update writer routine: %v", err)
7070
}
7171

7272
return w
@@ -77,7 +77,7 @@ func newUpdateWriter(store *store, ch *updateChan) *updateWriter {
7777
func (w *updateWriter) Close() {
7878
err := w.tg.Stop()
7979
if err != nil {
80-
w.store.log.Errorf("failed to stop the update writer routine: %w", err)
80+
w.store.log.Errorf("failed to stop the update writer routine: %v", err)
8181
}
8282
w.syncStates(w.ch.TryRecv())
8383
}

filebeat/input/journald/input.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (inp *journald) Run(
216216
if err := publisher.Publish(event, event.Private); err != nil {
217217
msg := fmt.Sprintf("could not publish event: %s", err)
218218
ctx.UpdateStatus(status.Failed, msg)
219-
logger.Errorf(msg)
219+
logger.Errorf("%s", msg)
220220
return err
221221
}
222222
}

filebeat/input/log/input.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func NewInput(
9797
cleanupIfNeeded := func(f func() error) {
9898
if cleanupNeeded {
9999
if err := f(); err != nil {
100-
logger.Named("input.log").Errorf("clean up function returned an error: %w", err)
100+
logger.Named("input.log").Errorf("clean up function returned an error: %v", err)
101101
}
102102
}
103103
}

0 commit comments

Comments
 (0)