savelog
is good, but I would prefer to have a tool that rotate the log according to date, and it doesn't change the extension of the file:
rotatelog -c 30 program.log
1, if the program.log is not created today, then rename it to program.20221219.log (assume today is 20221219. Assume there is no such file exists yet).
1.1, if the program.log is created today, leave it as is.
2, remove all program.xxx.log that are older than 30 days old.
If I add a cronjob to execute the current savelog
once every day, it would be very close to what I am thinking to have, but the filename keep changing, and I don't like it.