Skip to content

Commit

Permalink
fix: format log message correctly for heartbeat (#37369)
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshshanmugam authored Dec 11, 2023
1 parent cc8f5a1 commit 157b31a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions heartbeat/beater/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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."))
}
Expand All @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions x-pack/heartbeat/monitors/browser/source/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 157b31a

Please sign in to comment.