[Samba] Log rotation issue

Andrew Bartlett abartlet at samba.org
Sat Dec 2 05:27:11 UTC 2017

On Fri, 2017-12-01 at 16:06 +0530, Anantha Raghava via samba wrote:
> Hi,
> Continuing on the same subject, the VARIABLE SUBSTITUTIONS are not 
> working. for example, I want to have the date & time attached to the 
> samba log file. Hence I modified the smb.conf
> log file = /var/log/samba/samba.%T.log
> The file with name "samba.%T.log" gets created in /var/log/samba folder 
> and %T will not get substituted with current date & time.

Yes, currently the 'samba' side of things (compared with smbd) doesn't
know how to substitute the macros.  Now part of this is due to global
variables and multiple clients per connection, but it doesn't really
excuse us also skipping things like %T. 

> I request for your guidance to correct this part. Also the samba 
> continues to write into .old file as well and not finding any means to 
> correct it.

I think this is because each process only checks if the file should be
rotated every few lines, so they can hold the log open for quite some
time.  Ideally a global signal would be sent saying which file (or even
just that a file) just got rotated, so everyone can re-open.  

Patches are most welcome!

Andrew Bartlett
Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

More information about the samba mailing list