How to stop logrotate from changing the rotated logs owner
I have a logfile owner by the 'apache' user that I would like to rotate with logrotate.
I would like to do that by running logrotate as a different user, say 'web' using the copytruncate strategy.
That fails with this error:
error: error setting owner of ./logfile.log.1: Operation not permitted
But only because logrotate tries to change the owner of the new file to the owner of the rotated file, ie apache. But I dont care about the new files having the same owner, if logrotate would create copies with 'web' as owner that would be fine and then it could work fine.
So is there any way to stop logrotate from changing the owner of the copied file?
I use the create
directive in my /etc/logrotate.d/
files. Example:
create 0664 www-data www-data
create
will probably do what you describe in the last sentence of your question, but this option is incompatible with copytruncate
, which you also say you want to use.