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

Prospector and Harvester Cleanup #1144

Merged
merged 1 commit into from
Mar 18, 2016
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
7 changes: 3 additions & 4 deletions filebeat/crawler/prospector_stdin.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ func (p ProspectorStdin) Init() {
p.started = false
}

func (prospector ProspectorStdin) Run() {
func (p ProspectorStdin) Run() {

// Make sure stdin harvester is only started once
if !prospector.started {
prospector.harvester.Start()
if !p.started {
p.harvester.Start()
}

// Wait time during endless loop
oneSecond, _ := time.ParseDuration("1s")
time.Sleep(oneSecond)

}
2 changes: 1 addition & 1 deletion filebeat/crawler/registrar.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (r *Registrar) fetchState(filePath string, fileInfo os.FileInfo) (int64, bo
logp.Info("Not resuming rotated file: %s", filePath)
}

logp.Info("prospector", "New file. Start reading from the beginning: %s", filePath)
logp.Info("New file. Start reading from the beginning: %s", filePath)

// New file so just start from the beginning
return 0, false
Expand Down
3 changes: 0 additions & 3 deletions filebeat/harvester/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,3 @@ func (h *Harvester) initFileOffset(file *os.File) error {

return err
}

func (h *Harvester) Stop() {
}
14 changes: 6 additions & 8 deletions filebeat/harvester/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ import (
// In case of partial lines, readLine does return and error and en empty string
// This could potentialy be improved / replaced by https://github.com/elastic/beats/libbeat/tree/master/common/streambuf
func readLine(reader processor.LineProcessor) (time.Time, string, int, error) {
for {
l, err := reader.Next()
l, err := reader.Next()

// Full line read to be returned
if l.Bytes != 0 && err == nil {
return l.Ts, string(l.Content), l.Bytes, err
}

return time.Time{}, "", 0, err
// Full line read to be returned
if l.Bytes != 0 && err == nil {
return l.Ts, string(l.Content), l.Bytes, err
}

return time.Time{}, "", 0, err
}

// InitRegexps initializes a list of compiled regular expressions.
Expand Down