I use the following parameters for logging: log file = /var/log/samba/%m.log debug pid = yes log level = 1 max log size = 1000 All logfiles are rotated if they get bigger than the configured size (that's how it should be): # ls -lh 10.1.0.254.log* -rw-r--r-- 1 root root 12K 22. Feb 16:57 10.1.0.254.log -rw-r--r-- 1 root root 1M 21. Feb 11:43 10.1.0.254.log.old only the %m.log, is growing without end: # ls -lh %m.log -rw-r--r-- 1 root root 20M 22. Feb 17:35 %m.log
My answer to Björns posting on the samba-technical mailinglist: Am 21.03.2014 12:21, schrieb Bjoern Baumbach: > I tried to reproduce the problem which is described in bug 9673, since > it may be related to bug 10239. I've setup a very simple Samba v4-0-test > server, started the nmbd and smbd and verified that the log files > rotating as soon the max log size has been reached. > > This is my config: > ./bin/testparm -s > Load smb config files from /s4/logSizetest/etc/smb.conf > Loaded services file OK. > Server role: ROLE_STANDALONE > [global] > log file = /s4/logSizetest/var/rotateme-please-%m.log > max log size = 512 > > Any suggestion why my setup rotates the logs and other do not? The difference I see is, that yours is a standalone and on all machines I have this, are DCs. Also on DCs, the logs of the clients are rotated. But there's also one logfile named "%m.log" (with your config, It would be called "rotateme-please-%m.log"). This one contains output from the samba process and not from smbd or the child-smbds forked by connecting clients, I think. And this one isn't rotated
Problem still exists in 4.1.7. Setting product / version of this bug report to 4.1.7.
Update: In 4.5.0rc2, the rotation for the log file named %m.log still does not work.
Problem still exists in 4.6.0rc3.
(In reply to Marc Muehlfeld from comment #4) Have you tried 'samba-4.8.11' I cannot find problem in this version. My smb.conf [global] workgroup = WORKGROUP security = user passdb backend = tdbsam log level = 9 log file = /var/log/samba/%m.log debug pid = yes max log size = 100 [myshare] path = /share On connecting to share it rotates: # ls -ltr total 352 -rw-r--r--. 1 root root 0 May 2 12:53 log.smbd drwx------. 3 root root 4096 May 2 12:53 cores -rw-r--r--. 1 root root 92907 May 2 12:55 smbd.log -rw-r--r--. 1 root root 95196 May 2 12:55 127.0.0.1.log -rw-r--r--. 1 root root 115501 May 2 12:55 client.log.old <<<<<<<rotated -rw-r--r--. 1 root root 44819 May 2 13:00 client.log #
*** Bug 14123 has been marked as a duplicate of this bug. ***
Hi! Adam Xu opened a new bug 14123 which describes the same issue which we have here. If you are running Samba as an AD DC, the 'log file = /var/log/samba/%m.log' will lead the samba process to write into '/var/log/samba/%m.log' without replacing the substitution, while this works for the smbd processes. That the log rotation does not work for the samba (AD) process is a general issue, which is not related to the variable log file names. This issue exists since a long time. As a workaround you can use the logrotate service. If you move the log file and send a SIGHUP to *all* running samba processes, samba will reopen the log file with the original name and writes the log data into this new file. Best regards, Björn