Skip to content

Reread a log file from the beginning #886

Answered by jaqx0r
monegim asked this question in Q&A
Discussion options

You must be logged in to vote

It'll half-work, I think.

When mtail starts, it'll go to EOF to start reading "new" log lines. So the current fields won't be read.

Depending on how the file is rewritten it might work well or go badly:

  • If you write a new file and then rename it over the top of the old one, you'll have a new inode and mtail will notice and start at zero to read the new file.
  • If you truncate the current file and write over it, mtail will notice if the file offset is lower than the current position. Assuming you write mostly the same amount each time, this is probably going to end up with random successes and failures to read the new file.

If you append your data to the file it'll just work because that's…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jaqx0r
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #834 on June 24, 2024 12:07.