Rework log setup to be more reliably run out of ram as well as journald

This commit is contained in:
KemoNine 2020-08-13 20:11:39 -04:00
parent 64001e83a4
commit 58f0082708
3 changed files with 39 additions and 34 deletions

View file

@ -14,14 +14,14 @@ Items marked ```REQUIRED``` are assumed to be setup and working. You've been war
* [Finalize Setup (REQUIRED)](finalize_setup.md) * [Finalize Setup (REQUIRED)](finalize_setup.md)
* [Setup swap (REQUIRED)](swap.md) * [Setup swap (REQUIRED)](swap.md)
* [Additional Networking Setup (REQUIRED)](networking.md) * [Additional Networking Setup (REQUIRED)](networking.md)
* [Apt use RAM (VERY SMART FOR 4Gb RAM)](apt_cache_tmpfs.md)
* [Automatic Updates (VERY SMART)](auto_updates.md) * [Automatic Updates (VERY SMART)](auto_updates.md)
* [Logs in RAM (VERY SMART)](log2ram.md)
* [CPU Governor (VERY SMART)](cpu_governor.md)
* [Slideshow Prep (REQUIRED)](slideshow_prep.md) * [Slideshow Prep (REQUIRED)](slideshow_prep.md)
* [Slideshow Setup (REQUIRED)](slideshow.md) * [Slideshow Setup (REQUIRED)](slideshow.md)
* [Email Notifications (REQUIRED)](email_notifications.md) * [Email Notifications (REQUIRED)](email_notifications.md)
* [System Monitoring (REQUIRED)](monit.md) * [System Monitoring (REQUIRED)](monit.md)
* [CPU Governor (VERY SMART)](cpu_governor.md)
* [Logs in RAM (log2ram / VERY SMART)](log2ram.md)
* [Apt use RAM (VERY SMART FOR 4Gb RAM)](apt_cache_tmpfs.md)
* [Pimoroni Fan Shim](pimoroni_fan_shim.md) * [Pimoroni Fan Shim](pimoroni_fan_shim.md)
* [HDMI Scheduled On/Off](scheduled_display.md) * [HDMI Scheduled On/Off](scheduled_display.md)
* [Backups via restic](restic.md) * [Backups via restic](restic.md)

View file

@ -1,31 +0,0 @@
# log2ram
Move the logs to RAM with a single daily sync. This will help with keeping the micro sd card from being burned out from disk writes quickly.
``` sh
sudo -sHu root
git clone https://github.com/azlux/log2ram.git /opt/log2ram
cd /opt/log2ram
chmod +x install.sh
./install.sh
nano -w /etc/log2ram.conf
MAIL=false
SIZE=64M
LOG_DISK_SIZE=200M
# If you only want sync on shutdown/halt (you probably do...)
systemctl disable log2ram-daily.timer
systemctl reboot
sudo -sHu root
df -h /var/log
# If log2ram isn't working or fails due to out of space problems
# rm -rf /var/log/journal/*
# systemctl restart log2ram
# systemctl restart systemd-journald
```

36
docs/logging.md Normal file
View file

@ -0,0 +1,36 @@
# Logging
The below will re-work the way logs are handled on the system. Most of the logging will go into ram with syncs to disk only on reboot/shutdown. This will help keep the sd card from wearing out too fast.
``` sh
sudo -sHu root
git clone https://github.com/azlux/log2ram.git /opt/log2ram
cd /opt/log2ram
chmod +x install.sh
./install.sh
nano -w /etc/log2ram.conf
MAIL=false
SIZE=128M
LOG_DISK_SIZE=512M
# Only sync to disk on reboot/shutdown
systemctl disable log2ram-daily.timer
# Tweak journald to work out of ram
sed -i 's/#Storage=auto/Storage=volatile/g' /etc/systemd/journald.conf
sed -i 's/#Compress=yes/Compress=yes/g' /etc/systemd/journald.conf
sed -i 's/#SystemMaxUse=/SystemMaxUse=128M/g' /etc/systemd/journald.conf
systemctl reboot
sudo -sHu root
df -h /var/log
# If log2ram isn't working or fails due to out of space problems
# rm -rf /var/log/journal/*
# systemctl restart log2ram
# systemctl restart systemd-journald
```