I am looking for advice about logrotate.
I have recently installed log2ram to spare my ssd. Since I was not using all 24Gb RAM I assigned 2Gb to /var/log/. currently +- 300Mb is used.
I would like logrotate to move any file ending with .gz potentially in any sub-direcory to /var/old.log/ and maintain the sub-directory structure.
I have done some research and found a possible solution but now raises questions.
When logrotate runs this side script to move these files for example i moves /var/log/file.log.2.gz will it then not create a new file.log.2.gz when rotating logs instead of moving file.log.2.gz to file.log.3.gz as file.log.2.gz is no longer there. Then eventually the script overwrites the old logs due to the same name
I do not fully understand the olddir option as I understand this could do what I want. but manual states be cautious with wildcards. any help here
When to time this, /var/log is created during boot with the contents of /var/hdd.log/ it then updates /var/hdd.log when rebooting.
I want logrotate to move the compressed files to a other directory so It will not be loaded on the tmpfs but I don't want to edit each /etc/logrotate.d/* file.
I thought maybe put something before log2ram creates /var/log during boot but I do not know where.
This system runs 24/7 and I try to reboot as minimal as possible. OS: Ubuntu 22.04 LTS
Sometimes manuals are too obvious sometimes there very vague. Maybe someone can explain it in a more complex or easier way for me to understand.
Thank you for your time.