Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate: Log prospector to the input interface #6120

Merged
merged 1 commit into from
Feb 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion filebeat/input/docker/prospector.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewProspector(cfg *common.Config, outletFactory channel.Factory, context pr
if err := cfg.SetString("docker-json", -1, config.Containers.Stream); err != nil {
return nil, errors.Wrap(err, "update prospector config")
}
return log.NewProspector(cfg, outletFactory, context)
return log.NewInput(cfg, outletFactory, context)
}

func checkStream(val string) error {
Expand Down
16 changes: 8 additions & 8 deletions filebeat/input/log/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (
},
CleanInactive: 0,

// Prospector
// Input
Enabled: true,
IgnoreOlder: 0,
ScanFrequency: 10 * time.Second,
Expand Down Expand Up @@ -60,7 +60,7 @@ type config struct {
InputType string `config:"input_type"`
CleanInactive time.Duration `config:"clean_inactive" validate:"min=0"`

// Prospector
// Input
Enabled bool `config:"enabled"`
ExcludeFiles []match.Matcher `config:"exclude_files"`
IgnoreOlder time.Duration `config:"ignore_older"`
Expand All @@ -84,7 +84,7 @@ type config struct {
Multiline *reader.MultilineConfig `config:"multiline"`
JSON *reader.JSONConfig `config:"json"`

// Hidden on purpose, used by the docker prospector:
// Hidden on purpose, used by the docker input:
DockerJSON string `config:"docker-json"`
}

Expand Down Expand Up @@ -127,9 +127,9 @@ func (c *config) Validate() error {
c.Type = c.InputType
}

// Prospector
// Input
if c.Type == harvester.LogType && len(c.Paths) == 0 {
return fmt.Errorf("No paths were defined for prospector")
return fmt.Errorf("No paths were defined for input")
}

if c.CleanInactive != 0 && c.IgnoreOlder == 0 {
Expand Down Expand Up @@ -171,19 +171,19 @@ func (c *config) Validate() error {
// resolveRecursiveGlobs expands `**` from the globs in multiple patterns
func (c *config) resolveRecursiveGlobs() error {
if !c.RecursiveGlob {
logp.Debug("prospector", "recursive glob disabled")
logp.Debug("input", "recursive glob disabled")
return nil
}

logp.Debug("prospector", "recursive glob enabled")
logp.Debug("input", "recursive glob enabled")
var paths []string
for _, path := range c.Paths {
patterns, err := file.GlobPatterns(path, recursiveGlobDepth)
if err != nil {
return err
}
if len(patterns) > 1 {
logp.Debug("prospector", "%q expanded to %#v", path, patterns)
logp.Debug("input", "%q expanded to %#v", path, patterns)
}
paths = append(paths, patterns...)
}
Expand Down
2 changes: 1 addition & 1 deletion filebeat/input/log/harvester.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ func (h *Harvester) validateFile(f *os.File) error {
return fmt.Errorf("Tried to open non regular file: %q %s", info.Mode(), info.Name())
}

// Compares the stat of the opened file to the state given by the prospector. Abort if not match.
// Compares the stat of the opened file to the state given by the input. Abort if not match.
if !os.SameFile(h.state.Fileinfo, info) {
return errors.New("file info is not identical with opened file. Aborting harvesting and retrying file later again")
}
Expand Down
Loading