how to limit log file size in Samba4

I am running Samba4 4.1.11 on Slackware64 14.1. I have the following in my /etc/samba/smb.conf

   log level = 3 passdb:5 auth:10 winbind:2
   max log size = 5000

However, my samba log files are:
$ ls -lh /var/log/samba
total 137M
drwx------ 3 root root 4.0K 2015-02-24 20:29 cores/
-rw-r--r-- 1 root root 129M 2015-03-13 02:37 log.samba
-rw-r--r-- 1 root root 3.0M 2015-03-13 02:39 log.smbd
-rw-r--r-- 1 root root 4.9M 2015-03-13 01:49 log.smbd.old

Open in new window

It does seem to be limiting the log.smbd file to 5M, but the log.samba file just keeps growing. Is there another option for this log file? If so, I haven't come across it yet. I can do this in logrotate, but I'd rather use a samba directive so I don't have to restart samba.
Who is Participating?
Phil PhillipsDirector of DevOps & Quality AssuranceCommented:
I'm not too familiar with the internals of Samba log rotation, but you should be able to use logrotate without having a restart samba.  You can set it up so that logrotate sends Samba a SIGHUP (Samba "reloads" after a SIGHUP - this should also re-open file descriptors for log files).

You'll have to set "max log size" to 0 in this case though.
jmarkfoleyAuthor Commented:
Hmmm, I was hoping there was some additional samba config directive. Seems strange that the 'max log size' would apply to one logfile and not the other. I'll research a bit more before resorting to logrotate, although the SIGHUP idea is a good one.
You'll have to set "max log size" to 0 in this case though.
Actually, I don't think I'll have to do that as the log.smbd file seems to be the only one affected by the 'max log size' directive and that's taking care of itself just fine.
Phil PhillipsDirector of DevOps & Quality AssuranceCommented:
Yes, the ideal solution is a directive that'll apply to all files, so you don't have mismatched ways of rotating.  If I come across anything, I'll let you know.
jmarkfoleyAuthor Commented:
No samba-internal solutions appears to exists (that I can find) and the logrotate solutions seems to be working fine. Maybe the next release of Samba will include log.samba in its 'max log size' directivesm not just log.smbd
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.