Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
truncate syslog after suspend
Description=deletes all but the last 1000 lines of syslog due to possible logging spam by VLC
# save in /usr/local/sbin/
# deletes all but the last 1000 lines in syslog and vacuums journalctl down to 50 MB
tail -n $LINES /var/log/syslog > /tmp/tmpfile
cat /tmp/tmpfile > /var/log/syslog
rm /tmp/tmpfile
service syslog restart
journalctl --vacuum-size=50M
logger syslog "emptied and service restarted; journalctl vacuumed down to 50 MB"
sudo cp truncate_syslog_after_resume.service /etc/systemd/system/
sudo systemctl enable truncate_syslog_after_resume.service --now
Copy link

samirsaliba commented Feb 23, 2021

just added this after VLC spamming gbs into my syslog.
thanks for the help, @rubo77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment