Bug 9909 - samba log rotation is wrong
Summary: samba log rotation is wrong
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: samba
Version: 6.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Trond Eivind Glomsrxd
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-03-01 23:20 UTC by mal
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-03-16 22:19:02 UTC
Embargoed:


Attachments (Terms of Use)

Description mal 2000-03-01 23:20:50 UTC
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 23:30:59 UTC
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 22:19:59 UTC
Fixed in samba-2.0.6-10.

Comment 3 mal 2000-03-16 23:33:59 UTC
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 16:27:59 UTC
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.