Log rotation in Linux Clark Wilkins 2022.03.19
Directly related to the prior post, I needed to start log rolling on an Amazon EC2 server (Amazon Linux 2). In this case, I have multiple logs in a subdirectory of "home" that begin with the project name and end in log (i.e. /home/ec2-user/logs/my-project-api-errors.log).
This configuration file, saved in /etc/logrotate.d does the trick.
/home/ec2-user/logs/my-project*log {Breaking it down line-by-line:
Line 7 is important because this directory is readable by users other than root, and logrotate will complain if lines 6 and 7 do not match the suer and group.
Credit to this article for the tip.