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

SeekInfo is not reset on truncation if LocationInfo is provided #78

Open
pavan-kalyan opened this issue Dec 18, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@pavan-kalyan
Copy link

pavan-kalyan commented Dec 18, 2024

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.

@pavan-kalyan pavan-kalyan added the bug Something isn't working label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant