No output from logster
avdv opened this issue · comments
Trying to write a new FooLogster class, I got no output at all when testing the simplest log files.
Then, I realized these messages in the log:
WARNING /usr/sbin/logtail2 -f foo.log -o run/logtail-logster.parsers.[...].foo.state returned bad exit code None
In https://github.com/etsy/logster/blob/master/bin/logster#L388 the check of retval is wrong; according to the python docs, the return code of popen().close() is None if the command exited with status code zero.
Edit: I must admit that my analysis of the problem was incomplete. I realized that logster makes no output at all on the first run. So this warning is just spurious.
Thanks for submitting this and apologies for the delay
I believe the original code os.close() != 256
is expecting logtail to exit with a status code 1 when the state file doesn't exist (we're in the exception handler for an OSError
from the os.stat
call on a missing state file at this point). So, the logged warning is supposed to indicate that the call to logtail exited with a code other than 1.
From some testing, logtail doesn't appear to be exiting with status 1 when the state file doesn't exist; it's exiting with status 0. I'm presuming that this behaviour was changed at some point.
The upshot is that I believe your pull request to be correct. I'm going to try to confirm that this logtail behaviour is consistent across versions/platforms before merging into master.