Skip to content

Commit

Permalink
Improve logging for Size changes (elastic#5194)
Browse files Browse the repository at this point in the history
Right now in case the size changes of a file and it triggers reading a file again, in the debug log its not visibile what the new size is. This should make detecting issues like elastic#5179 easier.
  • Loading branch information
ruflin authored and tsg committed Sep 25, 2017
1 parent ae2f13b commit 57f67e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions filebeat/prospector/log/prospector.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ func (p *Prospector) harvestExistingFile(newState file.State, oldState file.Stat
// Resume harvesting of an old file we've stopped harvesting from
// This could also be an issue with force_close_older that a new harvester is started after each scan but not needed?
// One problem with comparing modTime is that it is in seconds, and scans can happen more then once a second
logp.Debug("prospector", "Resuming harvesting of file: %s, offset: %v", newState.Source, oldState.Offset)
logp.Debug("prospector", "Resuming harvesting of file: %s, offset: %d, new size: %d", newState.Source, oldState.Offset, newState.Fileinfo.Size())
err := p.startHarvester(newState, oldState.Offset)
if err != nil {
logp.Err("Harvester could not be started on existing file: %s, Err: %s", newState.Source, err)
Expand All @@ -459,7 +459,7 @@ func (p *Prospector) harvestExistingFile(newState file.State, oldState file.Stat

// File size was reduced -> truncated file
if oldState.Finished && newState.Fileinfo.Size() < oldState.Offset {
logp.Debug("prospector", "Old file was truncated. Starting from the beginning: %s", newState.Source)
logp.Debug("prospector", "Old file was truncated. Starting from the beginning: %s, offset: %d, new size: %d ", newState.Source, newState.Fileinfo.Size())
err := p.startHarvester(newState, 0)
if err != nil {
logp.Err("Harvester could not be started on truncated file: %s, Err: %s", newState.Source, err)
Expand Down

0 comments on commit 57f67e7

Please sign in to comment.