I am rotating my logs using logrotate in linux. I want to remove my logs older than 7 days. So I tried maxage option in logrotate but it is not working as expected.
Let say I have 6 logs which is created in the order shown below
Date filename
18th oct sample.log.2017-10-18
17th oct sample.log.2017-10-17
16th oct sample.log.2017-10-16
15th oct sample.log.2017-10-15
14th oct sample.log.2017-10-14
13th oct sample.log.2017-10-13
12th oct sample.log.2017-10-12
Today(19th oct) no sample log is created so no log is rotated and also sample.log.2017-10-12 needs to be deleted but it is not deleted why?
find logrotate property file below
/var/log/test/*.log {
missingok
notifempty
nocompress
daily
dateext
dateformat .%Y-%m-%d
maxage 7
}