How to configure log rotate to compress and archive logs weekly [closed]

Solution 1:

You could write a single configuration file with different stanzas, one for each file to be rotated and use the directives dateext, dateformat, olddir, but be carefull with olddir (your /mnt dir suggests that the physical device is different so, probably you should make use of postrotate to move rotated files)

olddir directory

Logs are moved into directory for rotation. The directory must be on the same physical device as the log file being rotated, and is assumed to be relative to the directory holding the log file unless an absolute path name is specified. When this option is used all old versions of the log end up in directory. This option may be overridden by the noolddir option.

Your configuration file would look (assuming the names stats.log and events.log as the ones of log files).

compress
weekly
rotate 120
dateext
dateformat _%Y-%m-%d

/opt/logs/stats/dc1/stats.log {
   olddir /mnt/logs/archive/stats/dc1/
}

/opt/logs/events/dc1/events.log {
   olddir /mnt/logs/archive/events/dc1/
}

...