When attempting to do log rotation on logstash's logs I get weirdness due to the Null-bytes problem.
I am using the following logrotate config:
/var/log/logstash/*.err /var/log/logstash/*.log /var/log/logstash/*.stdout {
copytruncate
missingok
rotate 5
size 200K
notifempty
sharedscripts
compress
delaycompress
nodateext
}
Seconds after log rotation happens, the new file size goes back up to the previous size.
I've tried restarting logstash in the postrotate script but for some reason this doesn't work.
Here is the relevant portion of my init.d script:
nice -n ${LS_NICE} chroot --userspec $LS_USER:$LS_GROUP / sh -c "
cd $LS_HOME
ulimit -n ${LS_OPEN_FILES}
exec \"$program\" $args
" > "${LS_LOG_DIR}/$name.stdout" 2> "${LS_LOG_DIR}/$name.err" &
Is there a way to tell logstash to release its log files?
Note: This was only for testing with the debug output plugin to simulate rotations often.
Also, i'm running logstash in a docker container.