[Samba] Issues with log rotation
Viktor Trojanovic
viktor at troja.ch
Wed Sep 1 09:06:24 UTC 2021
Hi,
On one of my systems running Samba 4.10.18-Ubuntu (by Louis) logs in
/var/log/samba are not being rotated which leads to the log folder getting
too big and bringing down the system.
I'm not sure what's going wrong here. In /etc/samba/smb.conf, I have
log level = 1
max log size = 10000
I don't have any reference to the log file as I assume that's only
necessary when deviating from the default. Clearly, log files in
/var/log/samba are being generated even in the absence of this entry.
On my Ubuntu system, there is further a logrotate entry for Samba in
/etc/logrotate.d/samba with the following content:
/var/log/samba/log.smbd {
weekly
missingok
rotate 7
postrotate
[ ! -x /usr/bin/smbcontrol ] || [ ! -f
/var/run/samba/smbd.pid ] || /usr/bin/smbcontrol smbd reload-config
endscript
compress
delaycompress
notifempty
}
/var/log/samba/log.nmbd {
weekly
missingok
rotate 7
postrotate
[ ! -x /usr/bin/smbcontrol ] || [ ! -f
/var/run/samba/nmbd.pid ] || /usr/bin/smbcontrol nmbd reload-config
endscript
compress
delaycompress
notifempty
}
/var/log/samba/log.samba {
weekly
missingok
rotate 7
postrotate
if [ -d /run/systemd/system ] && command systemctl
>/dev/null 2>&1 && systemctl is-active --quiet samba-ad-dc; then
systemctl kill --kill-who all --signal=SIGHUP
samba-ad-dc
elif [ -f /var/run/samba/samba.pid ]; then
# This only sends to main pid, See #803924
kill -HUP `cat /var/run/samba/samba.pid`
fi
endscript
compress
delaycompress
notifempty
}
I'm not sure how this fits together with the entries in smb.conf and if one
depends on the other. But my understanding is that /var/log/samba/log.samba
should be rotated weekly and that only 7 files should be kept.
Anyway, clearly neither one nor the other is working as log.samba is just
growing and growing and there is not a single .old file for log.samba.
Any advice on how to mitigate this situation?
Thanks,
Vic
More information about the samba
mailing list