I have a set of log files with the following permissions:
-rw-rw-r-- 1 club club
and my custom logroate file looks like below:
/home/club/club/log/* {
size 1M
dateext
dateformat .%Y%m%d-%s
missingok
rotate 1000
compress
notifempty
create 0664 club club
su club
}
but I get the error
error: error setting owner of /home/club/club/log/club.log.2019-04-05 to uid 1002 and gid 1002: Operation not permitted
How should I handle that? I was under the impression that by setting 'su club' it would be able to do whatever it wants with the logfiles, what is missing here?
su club? I don't really see a reason to use that here as the log rotation is usually run by root anyway, and you have acreatestatement that would recreate the log with an explicit owner and group.create ...by justcreate, as it then might not try doing the failing chown. With no args it is supposed to reproduce the old file's mode/user/group. Or perhaps usenocreateif your program will create it later. You should also consider replacing*by something that doesnt include the files that have already been rotated.su club club.