canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.87k stars 856 forks source link

[enhancement]: add logrotate config file #4509

Open laroche opened 11 months ago

laroche commented 11 months ago

Enhancement

Please consider adding a logrotate config file to your cloud-init source repository. Looking at bigger files in /var/log/, cloud-init grows quite big logging files.

Please also see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=926424 which ends also into a merge request at https://salsa.debian.org/cloud-team/cloud-init/-/merge_requests/6.

best regards,

Florian La Roche

itsaviral2609 commented 11 months ago

Hey @blackboxsw Can u guide me under which directory it will be added as logrotate file generally comes under /etc/logrotate.d. Will add this if i get to know more on this :) https://www.digitalocean.com/community/tutorials/how-to-manage-logfiles-with-logrotate-on-ubuntu-16-04

aciba90 commented 11 months ago

Thanks for making cloud-init better.

For debian derivatives, I think it is enough to create a cloud-init.logrotate file under the debian folder in the Ubuntu downstream branches: ubuntu/devel, ubuntu/mantic, ubuntu/jammy and ubuntu/focal. dh_installlogrotate will handle the installation of the config file under /etc/logrotate.d

In addition to that, cloud-init clean --logs and cloud-init collect-logs have to be aware of this new behavior.

And optionally, we tend to document packaging changes under packages/debian for packagers and testing.

blackboxsw commented 11 months ago

Thanks @aciba90 and correct, I think this is something we should look to implement. The cloud-init clean --logs and collect-logs determine their related log files from merged configuration in cloudinit.util.get_config_logfiles. It'd be good if we align cloud-init collect-logs and cloud-init clean --logs with the dynamic config-driven log file definitions so they both source util.get_config_logfiles if possible

chifac08 commented 8 months ago

Related PR #4721

aciba90 commented 8 months ago

https://github.com/canonical/cloud-init/pull/4721 added the support to collect and clean rotated logs, plus a reference log rotation config file.

What is missing is to add the logrotation config to ubuntu/devel under debian/, to add this to the devel series of Ubuntu.