Bug 245506 - log.%m naming scheme incompatible with logrotate
Summary: log.%m naming scheme incompatible with logrotate
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: samba
Version: 7
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Simo Sorce
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-06-24 16:10 UTC by Jordan Russell
Modified: 2007-11-30 22:12 UTC (History)
3 users (show)

Fixed In Version: 3.0.26a-6.fc7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-11-05 15:05:58 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jordan Russell 2007-06-24 16:10:00 UTC
Description of problem:
Recently, the default "log file" setting in smb.conf was changed from
"/var/log/samba/%m.log" to "/var/log/samba/log.%m". /etc/logrotate.d/samba now
specifies "log.*" as well. Problem is, the "log.*" pattern doesn't exclude files
that have already been rotated, causing log.smb.1.gz to become
log.smb.1.gz.1.gz, etc.

I believe this is a reoccurrence of bug #12832.

Version-Release number of selected component (if applicable):
samba-3.0.25a-3.fc7

How reproducible:
Always?

Steps to Reproduce:
On a machine that has been running Samba for several weeks, take a look at the
/var/log/samba directory:

-rw-r--r-- 1 root root  2655 Jun 23 18:30 log.smbd
-rw-r--r-- 1 root root   205 Jun 11 04:49 log.smbd.1.gz.1.gz

Actual results:
As you can see, it took an already-rotated log.smbd.1.gz file and re-rotated and
re-gzipped it. (Note: I have compression enabled in /etc/logrotate.conf.)

Expected results:
It shouldn't re-rotate already-rotated log files. Switching back to a "%m.log"
naming scheme would fix this.

Comment 1 Jordan Russell 2007-07-08 16:14:35 UTC
This bug also causes me to get an e-mail from the logrotate cron job every Sunday:

/etc/cron.daily/logrotate:
error: error opening /var/log/samba/log.machine.4.gz: No such file or directory


And here's what my /var/log/samba directory looks like after 5 weeks:

-rw-r--r-- 1 root root     0 Jul  6 04:49 log.0.0.0.0
-rw-r--r-- 1 root root     0 Jul  8 05:00 log.0.0.0.0.1.1
-rw-r--r-- 1 root root   146 Jul  8 05:00 log.0.0.0.0.1.1.1
-rw-r--r-- 1 root root     0 Jul  7 04:49 log.0.0.0.0.1.gz
-rw-r--r-- 1 root root   164 Jul  7 04:49 log.0.0.0.0.1.gz.1.gz
-rw-r--r-- 1 root root     0 Jul  8 05:00 log.0.0.0.0.2.gz.1
-rw-r--r-- 1 root root   163 Jul  8 05:00 log.0.0.0.0.2.gz.1.1
-rw-r--r-- 1 root root     0 Jul  1 05:00 log.0.0.0.0.3.gz
...
-rw-r--r-- 1 root root   746 Jul  8 10:59 log.machine
-rw-r--r-- 1 root root 28453 Jul  8 05:00 log.machine.1
-rw-r--r-- 1 root root     0 Jul  8 05:00 log.machine.1.1
-rw-r--r-- 1 root root 48104 Jul  8 05:00 log.machine.1.1.1
-rw-r--r-- 1 root root  1042 Jun 10 05:00 log.machine.5.gz
-rw-r--r-- 1 root root 51211 Jul  4 17:02 log.machine.old
...
-rw-r--r-- 1 root root  3512 Jul  6 11:29 log.nmbd
-rw-r--r-- 1 root root   345 Jun 10 05:00 log.nmbd.5.gz
-rw-r--r-- 1 root root  3876 Jul  6 11:23 log.smbd
-rw-r--r-- 1 root root   205 Jun 11 04:49 log.smbd.1.gz.1.gz
-rw-r--r-- 1 root root     0 Jun 11 04:49 log.smbd.5.gz

Comment 2 Jordan Russell 2007-09-20 04:50:32 UTC
Ping? This obvious regression is still present despite three updates to the
Samba packages for F7.

The fix, again, is to revert to the naming scheme used previously:
- in /etc/samba/smb.conf, change "log.%m" to "%m.log"
- in /etc/logrotate.d/samba, change "log.*" to "*.log"

Comment 3 Marcin Struzak 2007-09-24 23:35:46 UTC
The fix proposed in Comment #2 seems to work only for machine-specific logs.  I 
have log.smbd, log.nmbd, and log.swat that don't seem to be affected by the %
m.log directive; they all suffer from the recursive log numbering syndrome.  
Not sure if these paths are compiled into the binaries.  

Comment 4 Simo Sorce 2007-10-06 23:49:18 UTC
Found the solution,
I am adding an /var/log/samba/old/ directory to hold rotated logs.
This will solve the problem and also keep the main log dir a bit more clean.

Comment 5 Fedora Update System 2007-10-10 19:32:30 UTC
samba-3.0.26a-3.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update samba'

Comment 6 Jordan Russell 2007-10-13 18:36:51 UTC
Thanks, looks like that does indeed solve the problem.

Comment 7 Fedora Update System 2007-10-24 07:09:45 UTC
samba-3.0.26a-6.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update samba'

Comment 8 Fedora Update System 2007-11-05 15:05:54 UTC
samba-3.0.26a-6.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.


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