Skip to content

Commit

Permalink
[WIP] Remove error and add input ID for some crawler logs
Browse files Browse the repository at this point in the history
  • Loading branch information
belimawr committed Jun 18, 2024
1 parent 5b02142 commit a4bf294
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 17 additions & 1 deletion filebeat/beater/crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,28 @@ func (c *crawler) startInput(

c.inputs[id] = runner

c.log.Infof("Starting input (ID: %d)", id)
idFields := getRunnerID(runner)

c.log.Infow(fmt.Sprintf("Starting input (ID: %d)", id), idFields...)
runner.Start()

return nil
}

func getRunnerID(r cfgfile.Runner) []any {
type inputIDer interface {
InputID() string
}

idFields := []any{}
idRunner, ok := r.(inputIDer)
if ok {
idFields = append(idFields, "input_id", idRunner.InputID())
}

return idFields
}

func (c *crawler) Stop() {
c.log.Info("Stopping Crawler")

Expand Down
2 changes: 0 additions & 2 deletions filebeat/input/filestream/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,6 @@ func (inp *filestream) readFromSource(
}

ctx.UpdateStatus(status.Failed, "Failed on purpose")
return errors.New("Failed on purpose")

s.Offset += int64(message.Bytes)

metrics.MessagesRead.Inc()
Expand Down

0 comments on commit a4bf294

Please sign in to comment.