问题
Below are the challenges. Requesting your help on this.
- Files are not removing
- .gz files are not generated as per the user and group details given in the script.
- When I execute every time date extension is keep on adding to the same .gz files.
/var/log/httpd/access_log*
/var/log/httpd/error_log*
{
copytruncate
daily
rotate 2
compress
missingok
dateext
maxage 5
create 0644 hhh hhh
}
回答1:
/var/log/httpd/access_log*
/var/log/httpd/error_log*
Your wildcards are incorrect and catching literally everything in that directory, including the previously rotated files. The way you've defined it, logrotate is seeing the previously rotated files and treating them as new log files to start new rotations on, rather than old rotations of a previously-rotated log file. You need to tighten up your wildcards to something like this:
/var/log/httpd/*log
来源:https://stackoverflow.com/questions/56616953/files-are-not-removing-in-logrotate-script-and-permissions-and-user-group-detail