Chef postrotate command does not release log files
16:57:29 (0) eherot: ~
$ pgrep -l chef
32051 chef-client
16:57:34 (0) eherot: ~
$ sudo lsof -p 32051 | grep deleted
chef-clie 32051 root 7u CHR 136,0 0t0 3 /dev/pts/0 (deleted)
chef-clie 32051 root 10w REG 202,1 51714790 177895 /var/log/chef/client.log.1 (deleted)
chef-clie 32051 root 12w REG 202,1 113543697 131390 /var/log/chef/client.log.1 (deleted)
chef-clie 32051 root 13w REG 202,1 86169305 148256 /var/log/chef/client.log.1 (deleted)
16:57:48 (0) eherot: ~
$ sudo /etc/init.d/chef-client reload
* Reloading chef-client chef-client [ OK ]
16:58:02 (0) eherot: ~
$ sudo lsof -p 32051 | grep deleted
chef-clie 32051 root 7u CHR 136,0 0t0 3 /dev/pts/0 (deleted)
chef-clie 32051 root 10w REG 202,1 51714790 177895 /var/log/chef/client.log.1 (deleted)
chef-clie 32051 root 12w REG 202,1 113543697 131390 /var/log/chef/client.log.1 (deleted)
chef-clie 32051 root 13w REG 202,1 86169305 148256 /var/log/chef/client.log.1 (deleted)
This is most likely related to chef/chef#3435 but it would still be nice if this cookbook could include a workaround so that these files do not stick around forever on my system until this 9-months-old-and-counting bug is fixed.
It's the same bug, we ended up wrapping chef-client and overriding the default['chef_client']['log_rotation']['postrotate'] to restart instead of reload.
Similar: We switched to copytruncate.
@eherot Any chance you want to open a PR to change the logrotate config. This would be a nice one to fix.
I’m adding the Type: Jump In GitHub label to this issue. This is a great issue for someone to get their feet wet with and we’d love a PR to resolves the issue.