# /etc/logrotate.d/myapp
/var/log/myapp/*.log {
weekly
rotate 8
compress
delaycompress
missingok
notifempty
create 0640 myapp adm
}
sudo logrotate -d /etc/logrotate.d/myapp # debug: show what would happen
sudo logrotate -f /etc/logrotate.d/myapp # force a rotation now
rotate 8 keeps eight old logs; compress gzips them; missingok and notifempty avoid errors and empty rotations. If the program keeps the log file open, add copytruncate or a postrotate script that reloads it. Docker containers have their own log driver: set max-size and max-file in the compose file or daemon config.