piframe/docs/logging.md

37 lines
989 B
Markdown

# 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
```