Bug 245506 - log.%m naming scheme incompatible with logrotate
log.%m naming scheme incompatible with logrotate
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: samba (Show other bugs)
7
All Linux
low Severity medium
: ---
: ---
Assigned To: Simo Sorce
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-24 12:10 EDT by Jordan Russell
Modified: 2007-11-30 17:12 EST (History)
3 users (show)

See Also:
Fixed In Version: 3.0.26a-6.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-11-05 10:05:58 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 Jordan Russell 2007-06-24 12:10:00 EDT
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 12:14:35 EDT
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 00:50:32 EDT
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 19:35:46 EDT
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 19:49:18 EDT
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 15:32:30 EDT
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 14:36:51 EDT
Thanks, looks like that does indeed solve the problem.
Comment 7 Fedora Update System 2007-10-24 03:09:45 EDT
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 10:05:54 EST
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.