-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Describe the bug
When Location info is provided in tail.Config and the file is truncated to 0 and new lines are written to it. the tailer doesn't always return those new lines.
Expected behaviour
I would assume that when the file gets truncated the seek resets as it's potentially no longer applicable. In my case, I reset it to 0 (default behaviour in go's os.WriteFile).
I think there should be an option to do this or a way this event or info is exposed so, I can reset the seek.
To Reproduce
tailer, err := tail.TailFile(logFilePath, tail.Config{
Follow: true,
ReOpen: true,
MustExist: true,
Poll: false,
CompleteLines: false,
Location: &tail.SeekInfo{
Offset: 99999999999,
Whence: 0,
},
Logger: tail.DefaultLogger,
})
Then I do os.WriteFile(logFilePath, newDataOf555Bytes)
but tailer.Tell() still shows 99999999999 when trying to read the file. Even though, tail already reports reopening the file via the DefaultLogger.
System information
- tail version: e.g. 1.4.11
- OS: Ubuntu 22.04
- Arch: x64
Additional context
Add any other context about the problem here.