Bug 9909 - samba log rotation is wrong
samba log rotation is wrong
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: samba (Show other bugs)
6.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Trond Eivind Glomsrxd
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-03-01 18:20 EST by mal
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-03-16 17:19:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description mal 2000-03-01 18:20:50 EST
Currently /etc/smb.conf has

    max log size = 50

parameter set.
This causes samba log to be rotated TWICE.
First time by samba, second time by logrotate.
This is very inconvinient.
One may set
    max log size = 0
in config so logs will be rotated
only by logrotate.
But in this case it will be a problem
with individual host logs which are not rotated by logrotate.

Somehow this double-rotation problem should be addressed.
Comment 1 mal 2000-03-01 18:30:59 EST
In addition:
The best solution I see is:
1. Tell samba do not rotate logs
   max log size = 0
2. Tell logrotate to rotate ALL files
which satify the pattern
/var/log/samba/log.*
(logrotate understands file pattern)
and add option
 notifempty
to logrotate so old host access logs will not
be removed. This is pretty much current
samba behavior, but without double rotatation of logs.
Comment 2 Bill Nottingham 2000-03-16 17:19:59 EST
Fixed in samba-2.0.6-10.
Comment 3 mal 2000-03-16 18:33:59 EST
I did not check samba-2.0.6-10 but I have few comments
in addition to my letter

1. It would be better to to use nocreate option
   instead of noifempty so dummy empty files will not be created.

2. Does current logroatate version work well with files
   containining space, & | and etc. symbols?
   NETBIOS name may have any of these symbols in it,
   so log file name will also have these symbols.
   The test with logrotate-3.3-1 (from RedHat 6.1) shows
   that logrotate DOES NOT understand filenames with space in it.
   first time status file is created
logrotate state -- version 1
/tmp/lrb/f1.txt 2000-3-16
/tmp/lrb/x/ls | cat .log 2000-2-16

where last file "ls | cat .log" has special symbols in it.
netxt time I run  /usr/sbin/logrotate -s s.stat lr.conf
where lr.conf is:
/tmp/lrb/x/*.log {
 daily
}
logrotate prints
error: bad line 3 in state file s.stat
So it does not work with spaces in the filename,
which can be put there by samba.
Also, if logrotate passes the name to a shell it may be a security problem
in case of & | " ' ` etc sybmols.
The #2 problem is logrotate, not samba related.

3. The default samba log files have a pattern log.hostnameI
If you used logrotate pattern
/var/log/samba/log.* as I originally suggested
(I did not check new package samba-2.0.6-10)
this will cause logroatate to do multipple rotation of the same logs.
The logrotate status file will be
logrotate state -- version 1
/tmp/lrb/f1.txt 2000-2-16
/tmp/lrb/x/GGGG 2000-3-16
/tmp/lrb/x/GGGG.1 2000-3-16
/tmp/lrb/x/GGGG.2 2000-3-16

So my suggestion is to change log file format of samba
to
hostname.log instead of log.hostname.
This will fix the problem of item 3.
Comment 4 mal 2000-03-17 11:27:59 EST
In addition to item 1 of my previos posting:
logrotate options I suggest to samba log rotation are

nocreate
missingok

This will do the right thing for samba logs.

Note You need to log in before you can comment on or make changes to this bug.