-
Notifications
You must be signed in to change notification settings - Fork 36
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
tail -f like behavior for input file interfaces #15
Comments
Do you want to clone the "tail" branch? Hard week but I got some coding in on the train before the gin took effect. Needs cleaning up but should work like this: You need to specify persist=yes but with a regular filename (persist previously only worked with FIFOs). persist=fromstart will keep trying to open a file which isn't there when kplex starts up. Once opened, persist=yes or persist=fromstart should have tail-like behaviour. When EOF is reached kplex will close the file and re-stat it every milliseconds (specified with retry=, default 1 but might change that to 10: opinion welcomed). If the file has changed sized it will seek to the previous location and start reading from there. Currently if the file is smaller it will bomb out. Need to think about further checks there. Good idea on this: might be simpler for people than using FIFOs. This isn't really clean yet: haven't thought hard about file size overflow etc. |
I'll have a look. Thanks for the quick implementation! |
Needs some tidying. Pushed one fix this morning. Have to make ptys work
the same way too....
|
I haven't had a chance to look at the new functionality yet - I hope to shortly. When kplex starts up, does it first seek to the end of the file, and then start pushing the data out? Or does it start at the beginning of the file, send it all, and then wait for more data to arrive? In the case of the file being smaller.... Maybe it should start from the beginning? As if the file it is reading from is a log file that's been truncated? I'm not sure... |
It starts at the beginning, sends it all, closes the file, then periodically stats the file. If it grows it opens the file again, seeks to the point it left off and reads from there. If the file shrinks it currently logs an error message and exits but as you say maybe that's not the right thing to do and it should start again from the beginning |
Do you think you could add an option that would have kplex on startup, seek to the end of the file, and then periodically stat the file from there on? |
I'll look into it later this week |
Add tail -f like behavior to input file interfaces.
The text was updated successfully, but these errors were encountered: