File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5555
5656 envs :
5757 - ALLOW_USER_PASSWD
58+ - FREQUENT_LOG_VACUUM
Original file line number Diff line number Diff line change @@ -47,6 +47,34 @@ if [ -n "$ALLOW_USER_PASSWD" ]; then
4747 sudo yq -yi ' .system_info.default_user.lock_passwd |= false' /etc/cloud/cloud.cfg
4848fi
4949
50+ FREQUENT_LOG_VACUUM=${FREQUENT_LOG_VACUUM-}
51+ if [ -n " $FREQUENT_LOG_VACUUM " ]; then
52+ # Optimize log rotation
53+ echo " 0 * * * * root journalctl --vacuum-size=500M" | sudo tee /etc/cron.d/genesis_vacuum_logs > /dev/null
54+ cat << EOF | sudo tee /etc/logrotate.d/rsyslog > /dev/null
55+ /var/log/syslog
56+ /var/log/mail.log
57+ /var/log/kern.log
58+ /var/log/auth.log
59+ /var/log/user.log
60+ /var/log/cron.log
61+ {
62+ rotate 5
63+ hourly
64+ size 100M
65+ missingok
66+ notifempty
67+ compress
68+ delaycompress
69+ sharedscripts
70+ postrotate
71+ /usr/lib/rsyslog/rsyslog-rotate
72+ endscript
73+ }
74+ EOF
75+ echo " 1 * * * * root systemctl start logrotate" | sudo tee -a /etc/cron.d/genesis_vacuum_logs > /dev/null
76+ fi
77+
5078# Useful for all-in-one-vm tests
5179# sudo apt install qemu-kvm libvirt-daemon-system zfsutils-linux \
5280# libvirt-daemon-driver-storage-zfs libvirt-clients -y
You can’t perform that action at this time.
0 commit comments