logrotate prerotate code example
Example: logrotate
# Specify the dir that you would like to rotate in the first line.
# You can use daily, weekly or monthly rotation
# On 'rotate' section you can define how many days the log will be kept.
/home/ubuntu/log_dir/* {
daily
rotate 7
size 100M
compress
dateext
dateformat -%d%m%Y
}