I have a multi-threaded rails application, and it has many workers, which pull messages from resque queue and log messages. I have put linux logrotate to rotate the log and and then upload to S3.
After uploading and deleting a file, I see that the disk space is still used, and is not released. When I execute the command below, I see lots of files.
lsof | grep deleted
ruby 14530 fadmin 7w REG 202,1 1972144092 407325 /home/log/production_database.log.1 (deleted)
ruby-time 14536 20352 fadmin 7w REG 202,1 1972144092 407325 /home/log/production_database.log.1 (deleted)
It fills the disk space every time. It releases space only if I kill all Ruby processes.
Can I know what the best way is to rotate logs, and how I should avoid the problem?