chef-client icon indicating copy to clipboard operation
chef-client copied to clipboard

Chef postrotate command does not release log files

Open eherot opened this issue 9 years ago • 4 comments

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.

eherot avatar Mar 01 '16 17:03 eherot

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.

cachamber avatar Mar 01 '16 21:03 cachamber

Similar: We switched to copytruncate.

eherot avatar Mar 01 '16 22:03 eherot

@eherot Any chance you want to open a PR to change the logrotate config. This would be a nice one to fix.

tas50 avatar Aug 11 '17 21:08 tas50

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.

tas50 avatar Sep 09 '17 04:09 tas50