Posts: 2
Threads: 1
Joined: Mar 2025
Reputation:
0
Hi,
Moode 9.2.6
I noticed that /var/log was nearly full, and that it remained so after a reboot.
I use the standard 32 MB setting for log2ram.
Most of the space was taken by accumulated Samba logs in /var/log/samba, so I removed the samba folder contents and rebooted.
Is there anything that can be done to prevent this accumulation of samba logs in the future?
Thanks for any suggestions.
Posts: 14,152
Threads: 323
Joined: Mar 2018
Reputation:
578
Sure. Edit the file /var/www/util/sysutil.sh, scroll down to the "clear-syslogs" section and make the modifications below (bolded).
Then run the command sudo /var/www/util/sysutil.sh clear-syslogs
It will also run every 3 hours as part of the built in maintenance task and so it should help keep /var/logs from taking too much space.
# TODO: review this section
if [[ $1 = "clear-syslogs" ]]; then
journalctl --vacuum-files=1 2> /dev/null
truncate /var/log/alternatives.log --size 0
truncate /var/log/apt/history.log --size 0
truncate /var/log/apt/term.log --size 0
truncate /var/log/auth.log --size 0
truncate /var/log/bootstrap.log --size 0
truncate /var/log/daemon.log --size 0
truncate /var/log/debug --size 0
truncate /var/log/dpkg.log --size 0
truncate /var/log/faillog --size 0
truncate /var/log/kern.log --size 0
truncate /var/log/lastlog --size 0
truncate /var/log/messages --size 0
truncate /var/log/minidlna.log --size 0
truncate /var/log/mpd/log --size 0
truncate /var/log/nginx/access.log --size 0
truncate /var/log/nginx/error.log --size 0
truncate /var/log/php*-fpm.log --size 0
truncate /var/log/php_errors.log --size 0
truncate /var/log/regen_ssh_keys.log --size 0
truncate /var/log/samba/log.nmbd --size 0
truncate /var/log/samba/log.smbd --size 0
truncate /var/log/moode_shairport-sync.log --size 0
truncate /var/log/moode_librespot.log --size 0
truncate /var/log/moode_mountmon.log --size 0
truncate /var/log/moode_spotevent.log --size 0
truncate /var/log/moode_spsevent.log --size 0
truncate /var/log/moode_slpower.log --size 0
truncate /var/log/user.log --size 0
truncate /var/log/wtmp --size 0
truncate /var/log/Xorg.*.log --size 0
truncate /var/log/log2ram.log --size 0
# Rotated logs from settings in /etc/logrotate.d
rm /var/log/*.log.* 2> /dev/null
rm /var/log/debug.* 2> /dev/null
rm /var/log/messages.* 2> /dev/null
rm /var/log/btmp.* 2> /dev/null
rm /var/log/apt/*.log.* 2> /dev/null
rm /var/log/nginx/*.log.* 2> /dev/null
#rm /var/log/samba/log.wb* 2> /dev/null
#rm /var/log/samba/log.winbindd 2> /dev/null
rm /var/log/samba/log* 2> /dev/null
exit
fi