Using maxage in conjuction with rotate in logrotate
by Brief-Wishbone9091 from LinuxQuestions.org on (#6E38F)
I've read these blogs about maxage and rotate when used in conjunction and I'm still confused about it.
https://www.clearos.com/clearfoundat...tate-vs-maxage
https://unix.stackexchange.com/quest...maxage-command
https://www.net7.be/blog/article/con...logrotate.html
I imagine a scenario like this.
{
daily
rotate 10
maxage 5
}
First day:
application.log
rotation_count=1<10=>do nothing
age_of_oldest_log=0 days<5=>do nothing
Second day:
application.log
application.log_first_day
rotation_count=2<10=>do nothing
age_of_oldest_log=1 days<5=>do nothing
Third day:
application.log
application.log_first_day
application.log_second_day
rotation_count=3<10=>do nothing
age_of_oldest_log=2 days<5=>do nothing
Fourth day:
application.log
application.log_first_day
application.log_second_day
application.log_third_day
rotation_count=4<10=>do nothing
age_of_oldest_log=3 days<5=>do nothing
Fifth day:
application.log
application.log_first_day
application.log_second_day
application.log_third_day
application.log_fourth_day
rotation_count=5<10=>do nothing
age_of_oldest_log=4 days<5=>do nothing
Sixth day:
application.log
application.log_first_day
application.log_second_day
application.log_third_day
application.log_fourth_day
application.log_fifth_day
rotation_count=6<10 =>do nothing
age_of_oldest_log=5 days!<5=>delete the oldest log application.log_first_day
Seventh day:
application.log
application.log_second_day
application.log_third_day
application.log_fourth_day
application.log_fifth_day
application.log_sixth_day
rotation_count=7<10 => do nothing
age_of_oldest_log=5!<5=>delete the oldest log application.log_second_day
Eighth day:
application.log
application.log_third_day
application.log_fourth_day
application.log_fifth_day
application.log_sixth_day
application.log_seventh_day
rotation_count=8<10=>do nothing
age_of_oldest_log=5!<5=>delete the oldest log application.log_third_day
Ninth day:
application.log
application.log_fifth_day
application.log_sixth_day
application.log_seventh_day
application.log_eighth_day
rotation_count=9<10=>do nothing
age_of_oldest_log=5!<5=>delete the oldest log application.log_fourth_day
Tenth day:
application.log
application.log_seventh_day
application.log_eighth_day
application.log_ninth_day
rotation_count=10!<10=>remove the oldest file after 10 rotations thusremove application.log_fifth_day
age_of_oldest_log=4!<5=>do nothing.
Eleventh day:
application.log
application.log_eighth_day
application.log_ninth_day
application.log_ninth_day
rotation_count=11!<10=>remove the oldest log file ie application.log_seventh_day
age_of_oldest_log=3<5=>do nothing.
Is this how it works? Or am I missing something?
https://www.clearos.com/clearfoundat...tate-vs-maxage
https://unix.stackexchange.com/quest...maxage-command
https://www.net7.be/blog/article/con...logrotate.html
I imagine a scenario like this.
{
daily
rotate 10
maxage 5
}
First day:
application.log
rotation_count=1<10=>do nothing
age_of_oldest_log=0 days<5=>do nothing
Second day:
application.log
application.log_first_day
rotation_count=2<10=>do nothing
age_of_oldest_log=1 days<5=>do nothing
Third day:
application.log
application.log_first_day
application.log_second_day
rotation_count=3<10=>do nothing
age_of_oldest_log=2 days<5=>do nothing
Fourth day:
application.log
application.log_first_day
application.log_second_day
application.log_third_day
rotation_count=4<10=>do nothing
age_of_oldest_log=3 days<5=>do nothing
Fifth day:
application.log
application.log_first_day
application.log_second_day
application.log_third_day
application.log_fourth_day
rotation_count=5<10=>do nothing
age_of_oldest_log=4 days<5=>do nothing
Sixth day:
application.log
application.log_first_day
application.log_second_day
application.log_third_day
application.log_fourth_day
application.log_fifth_day
rotation_count=6<10 =>do nothing
age_of_oldest_log=5 days!<5=>delete the oldest log application.log_first_day
Seventh day:
application.log
application.log_second_day
application.log_third_day
application.log_fourth_day
application.log_fifth_day
application.log_sixth_day
rotation_count=7<10 => do nothing
age_of_oldest_log=5!<5=>delete the oldest log application.log_second_day
Eighth day:
application.log
application.log_third_day
application.log_fourth_day
application.log_fifth_day
application.log_sixth_day
application.log_seventh_day
rotation_count=8<10=>do nothing
age_of_oldest_log=5!<5=>delete the oldest log application.log_third_day
Ninth day:
application.log
application.log_fifth_day
application.log_sixth_day
application.log_seventh_day
application.log_eighth_day
rotation_count=9<10=>do nothing
age_of_oldest_log=5!<5=>delete the oldest log application.log_fourth_day
Tenth day:
application.log
application.log_seventh_day
application.log_eighth_day
application.log_ninth_day
rotation_count=10!<10=>remove the oldest file after 10 rotations thusremove application.log_fifth_day
age_of_oldest_log=4!<5=>do nothing.
Eleventh day:
application.log
application.log_eighth_day
application.log_ninth_day
application.log_ninth_day
rotation_count=11!<10=>remove the oldest log file ie application.log_seventh_day
age_of_oldest_log=3<5=>do nothing.
Is this how it works? Or am I missing something?