From 1a8aaefa81b53a982d8a8e9e7442f502d8d0aa37 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 12 Dec 2023 18:10:47 -0800 Subject: [PATCH] fix: format log message correctly for heartbeat (#37369) (#37428) (cherry picked from commit 157b31a79e3ad52578f30399049cac030d688934) Co-authored-by: Vignesh Shanmugam --- heartbeat/beater/heartbeat.go | 6 +++--- x-pack/heartbeat/monitors/browser/source/project.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/heartbeat/beater/heartbeat.go b/heartbeat/beater/heartbeat.go index 8e4d39480f2..e4e5a5129a8 100644 --- a/heartbeat/beater/heartbeat.go +++ b/heartbeat/beater/heartbeat.go @@ -162,7 +162,7 @@ func (bt *Heartbeat) Run(b *beat.Beat) error { logp.L().Info("heartbeat is running! Hit CTRL-C to stop it.") groups, _ := syscall.Getgroups() - logp.L().Info("Effective user/group ids: %d/%d, with groups: %v", syscall.Geteuid(), syscall.Getegid(), groups) + logp.L().Infof("Effective user/group ids: %d/%d, with groups: %v", syscall.Geteuid(), syscall.Getegid(), groups) waitMonitors := monitors.NewSignalWait() @@ -226,7 +226,7 @@ func (bt *Heartbeat) Run(b *beat.Beat) error { waitPublished.AddChan(bt.done) waitPublished.Add(monitors.WithLog(pipelineWrapper.Wait, "shutdown: finished publishing events.")) if bt.config.PublishTimeout > 0 { - logp.Info("shutdown: output timer started. Waiting for max %v.", bt.config.PublishTimeout) + logp.L().Infof("shutdown: output timer started. Waiting for max %v.", bt.config.PublishTimeout) waitPublished.Add(monitors.WithLog(monitors.WaitDuration(bt.config.PublishTimeout), "shutdown: timed out waiting for pipeline to publish events.")) } @@ -241,7 +241,7 @@ func (bt *Heartbeat) RunStaticMonitors(b *beat.Beat, pipeline beat.Pipeline) (st created, err := bt.monitorFactory.Create(pipeline, cfg) if err != nil { if errors.Is(err, monitors.ErrMonitorDisabled) { - logp.L().Info("skipping disabled monitor: %s", err) + logp.L().Infof("skipping disabled monitor: %s", err) continue // don't stop loading monitors just because they're disabled } diff --git a/x-pack/heartbeat/monitors/browser/source/project.go b/x-pack/heartbeat/monitors/browser/source/project.go index af6bd96dfdc..7c11de31134 100644 --- a/x-pack/heartbeat/monitors/browser/source/project.go +++ b/x-pack/heartbeat/monitors/browser/source/project.go @@ -168,8 +168,8 @@ func (p *ProjectSource) Close() error { func runSimpleCommand(cmd *exec.Cmd, dir string) error { cmd.Dir = dir - logp.L().Info("Running %s in %s", cmd, dir) + logp.L().Infof("Running %s in %s", cmd, dir) output, err := cmd.CombinedOutput() - logp.L().Info("Ran %s (%d) got '%s': (%s) as (%d/%d)", cmd, cmd.ProcessState.ExitCode(), string(output), err, syscall.Getuid(), syscall.Geteuid()) + logp.L().Infof("Ran %s (%d) got '%s': (%s) as (%d/%d)", cmd, cmd.ProcessState.ExitCode(), string(output), err, syscall.Getuid(), syscall.Geteuid()) return err }