Eric Maryniak
2000-Oct-17 14:33 UTC
Requests for an option "nmbd log file" and -l (log file), possible log filename bug, and minor nitpicking
Dear readers, I read that I should post/discuss requests for enhancements for which one is unable to provide a fix (as diff -u), so here goes... please excuse my ignorance about Samba or proper etiquette on this list --- I'm new! By the way: I'm a happy user of Samba and have introduced it with success at my current employer (and the previous two). This great software seems to keep swinging ;-) ==While playing with the log file options and smbd/nmbd -l, I noticed a couple of things (Samba version 2.0.5a on SuSE Linux 6.3 i386, kernel 2.2.13). Nothing serious and some of them are nitpicking :) 1/4. Feature request: "nmbd log file" (and perhaps: "smbd log file"). I have a feature request for a new (or actually two) options in the smb.conf: nmbd log file = /var/log/samba.nmb.%m.log which allows you to overrule the default log file location of nmbd (note that %m is used). For orthogonality another option could be added as well: smbd log file = /var/log/samba.smb.%m.log which would be synonymous to the already existing: log file = /var/log/samba.smb.%m.log In order not to break older smb.conf's, "log file" should be kept, but become synonymous with "smbd log file" (or the other way around :) 2/4. Feature request: '-l' option of nmbd does not append '.nmb' cq. uses the "nmbd log file" setting (see feature request 1). When I specifically set the log file for nmbd during startup, like: /usr/sbin/nmbd -D -l /var/log/samba.nmb.log the actual filename becomes: /var/log/samba.nmb.log.nmb This is documented behaviour in 'man nmbd'. This appending is somewhat problematic if you like your log files to end in '*.log' (and have a default action for double-clicking in Windows on a '.log' file to open it in ones favorite editor ;-) I realize I could hack the source, but wonder if this behaviour could be altered (without breaking old software and configs). I see three possibilities: a. Honor the new option "nmbd log file" :) b. Introduce another flag (-L, for "hard" logfile name), while keeping the existing -l with it's original behaviour c. Scan a filename (given with -l) for the pattern (\.nmb)|(nmb\.) and if so, automagically do _not_ append ".nmb" to the base name. 3/4. Possible bug determining log file name of smbd. When I call smbd -D, /without/ -l, but /with/ a "log file" option in smb.conf (like: log file = /var/log/samba.smb.%m.log), the smb daemon will still create a file "log.smb", albeit with only one log entry, like: [2000/03/14 15:13:22, 1] smbd/server.c:main(628) smbd version 2.0.5a started. Copyright Andrew Tridgell 1992-1998 This file does not grow anymore and all subsequent logging goes to samba.smb.smb.log as expected (apparently "%m" is replaced with "smb" for the server itself) and samba.smb.PcNetBIOSname.log for each PC. It seems like smbd already opens a log file, prior to processing smb.conf (where the logfile is redefined)? Only giving the log file with '-l' seems to be able to overrule log.smb. Site note 1: Instead of "smb" for the server itself (for %m), I would have simply expected the (netbios or dns/gethostname()) name of the server (being in this case sort of a client of itself). Site note 2: Andrew has no copyright any longer? ;-) (should be 1992-2000?!) Site note 3: The date format of the log entries seems to be in ISO 8601 format (CCYY-MM-DD HH:MM:SS, ref: http://www.cl.cam.ac.uk/~mgk25/iso-time.html ) The separator, "/", however is not correct. It should be "-", like: [2000-03-14 15:13:36, 1] smbd/service.c:make_connection(521) ... And perhaps add the tz in official iso parlance if you don't live in Greenwich, which makes your log files really self-contained: [2000-03-14 15:13:36 +01:00, 1] smbd/service.c:make_connection(521) ... 4/4. Feature request: %D (ISO 8601 date and time) alternative for %T OR (better?) augmented snprintf()-aware %{%...}T While on ISO 8601 date issue, a new date variable, say %D, would be very handy (expanding to CCYYMMDD): nmbd log file = /var/log/samba.nmb.%D.log smbd log file = /var/log/samba.smb.%D.log resulting in log files like: /var/log/samba.nmb.20000401.log /var/log/samba.nmb.20000430.log ... /var/log/samba.smb.20000401.log /var/log/samba.smb.20000430.log this would make log file rotation a breeze, enabling you to use shell scripts with ` date '+%Y%m%d' ` to loop over them. **** OR (better?!): A truly cool feature, and perhaps better because more generic, would be to augment %T with snprintf() functionality, like used in proftpd (www.proftpd.net) for LogFormat: nmbd log file = /var/log/samba.nmb.%{%Y-%m-%d}T.log smbd log file = /var/log/samba.smb.%{%Y-%m-%d}T.log resulting in log files like: /var/log/samba.nmb.2000-04-01.log /var/log/samba.nmb.2000-04-30.log ... /var/log/samba.smb.2000-04-01.log /var/log/samba.smb.2000-04-30.log Thanx for a very fine and stable product, Bye-bye, Eric -- Eric Maryniak <e.maryniak@pobox.com> Home page: http://pobox.com/~e.maryniak/ University of Amsterdam, Department of Psychology. Tel/Fax: +31 20 5256853/6391656. Internet: http://www.neuromod.org/ To be is to do. - I. Kant To do is to be. - J.P. Sartre Yabba-Dabba-Doo! - F. Flintstone