|
Is there a way to have |
Replies: 5 comments
|
I am not sure what you want to do here. The simple answer is no, A slightly more complex answer is, yes, if the log file it is reading gets truncated and is restarted by the log writer, If you are experimenting, then the |
|
I was considering using |
|
It'll half-work, I think. When Depending on how the file is rewritten it might work well or go badly:
If you append your data to the file it'll just work because that's how logs tend to go. We could add a new flag that says this is not a log file, but a status file, and change the reader behaviour to cope with this mechanism. |
Great, thank you for the information. Should I contribute to the development of this feature, or is it already planned for a future release? |
|
This is not planned. You may send me some PRs if you like. |
It'll half-work, I think.
When
mtailstarts, 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:
mtailwill notice and start at zero to read the new file.mtailwill 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…