{"action":"opened","issue":{"url":"https://api.github.com/repos/josegonzalez/python-beaver/issues/330","labels_url":"https://api.github.com/repos/josegonzalez/python-beaver/issues/330/labels{/name}","comments_url":"https://api.github.com/repos/josegonzalez/python-beaver/issues/330/comments","events_url":"https://api.github.com/repos/josegonzalez/python-beaver/issues/330/events","html_url":"https://github.com/josegonzalez/python-beaver/issues/330","id":98797060,"number":330,"title":"Beaver holds orphaned file handles after logrotate","user":{"login":"everestx","id":1696378,"avatar_url":"https://avatars.githubusercontent.com/u/1696378?v=3","gravatar_id":"","url":"https://api.github.com/users/everestx","html_url":"https://github.com/everestx","followers_url":"https://api.github.com/users/everestx/followers","following_url":"https://api.github.com/users/everestx/following{/other_user}","gists_url":"https://api.github.com/users/everestx/gists{/gist_id}","starred_url":"https://api.github.com/users/everestx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/everestx/subscriptions","organizations_url":"https://api.github.com/users/everestx/orgs","repos_url":"https://api.github.com/users/everestx/repos","events_url":"https://api.github.com/users/everestx/events{/privacy}","received_events_url":"https://api.github.com/users/everestx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-03T17:19:13Z","updated_at":"2015-08-03T17:19:13Z","closed_at":null,"body":"Hello, We're seeing problems with using logrotate and beaver together.  The behavior is experienced when logrotate renames a file and then gzips the log file.  Beaver keeps the old renamed file handle open even though it no longer exists.  The end result is that the disk capacity is misreported since beaver still attempts to use the old file handle.\r\n\r\n_NOTE:_ this doesn't seem to happen with copytruncate logrotate commands.\r\n\r\nSee lsof for beaver processes:\r\n```\r\nroot@myhost:myuser> lsof -p 11342 -p 11347 -p 12508 | grep deleted\r\nbeaver  12508 root   10r   REG    253,2 2724534313   368704 /pub/app/shared/log/logstash_sidekiq_production.log-20150802 (deleted)\r\nbeaver  12508 root   11r   REG    253,2 2587956759   368692 /pub/app/shared/log/logstash_production.log-20150802 (deleted)\r\nbeaver  12508 root   30r   REG    253,2    1771264   368710 /pub/app/shared/log/newrelic_agent.log-20150719 (deleted)\r\nbeaver  12508 root   33r   REG    253,2  170363027   368715 /pub/app/shared/log/production.log-20150719 (deleted)\r\n```\r\n\r\nSee beaver.log\r\n```\r\n[2015-08-02 04:33:03,064] INFO    [fd02g5a04e] - file rotated /pub/app/shared/log/production.log\r\n[2015-08-02 04:33:03,065] INFO    [fd02g5a04e] - un-watching logfile /pub/app/shared/log/production.log\r\n[2015-08-02 04:33:03,065] INFO    [fd02g5a03c] - watching logfile /pub/app/shared/log/production.log\r\n[2015-08-02 04:33:06,136] INFO    [fd02g5a034] - file rotated /pub/app/shared/log/logstash_production.log\r\n[2015-08-02 04:33:06,137] INFO    [fd02g5a034] - un-watching logfile /pub/app/shared/log/logstash_production.log\r\n[2015-08-02 04:33:06,137] INFO    [fd02g5a04a] - watching logfile /pub/app/shared/log/logstash_production.log\r\n[2015-08-02 04:33:06,445] INFO    [fd02g5a045] - file rotated /pub/app/shared/log/newrelic_agent.log\r\n[2015-08-02 04:33:06,445] INFO    [fd02g5a045] - un-watching logfile /pub/app/shared/log/newrelic_agent.log\r\n[2015-08-02 04:33:06,445] INFO    [fd02g5a047] - watching logfile /pub/app/shared/log/newrelic_agent.log\r\n[2015-08-02 04:33:53,225] INFO    [fd02g5a040] - file rotated /pub/app/shared/log/logstash_sidekiq_production.log\r\n[2015-08-02 04:33:53,226] INFO    [fd02g5a040] - un-watching logfile /pub/app/shared/log/logstash_sidekiq_production.log\r\n[2015-08-02 04:33:53,226] INFO    [fd02g5a052] - watching logfile /pub/app/shared/log/logstash_sidekiq_production.log\r\n```"}}