It seems that when log rotation runs and truncates (because copytrunate is set) the file is still open pointing at the end thus causing the file pointer null bytes problem.
This causes the filesystem to think that the truncated file is still the same size, thus rotation happens every time even though the true file size (ls -lsh) is small.
Other programs (like nginx) fix this by sending a signal to the process so it will release the file.
I noticed that logstash is started with nice and thats where stdout and stderr are redirected to the log locations. There should be a way to send a signal to nice or the process it starts to enable this. If I find it, i'll submit a PR.
It seems that when log rotation runs and truncates (because
copytrunateis set) the file is still open pointing at the end thus causing the file pointer null bytes problem.This causes the filesystem to think that the truncated file is still the same size, thus rotation happens every time even though the true file size (
ls -lsh) is small.Other programs (like nginx) fix this by sending a signal to the process so it will release the file.
I noticed that logstash is started with
niceand thats where stdout and stderr are redirected to the log locations. There should be a way to send a signal toniceor the process it starts to enable this. If I find it, i'll submit a PR.