FS#5980 - samba logrotate file creates recursive log names

Attached to Project: Arch Linux
Opened by Dan McGee (toofishes) - Monday, 11 December 2006, 04:01 GMT
Last edited by Tobias Powalowski (tpowa) - Thursday, 25 October 2007, 13:00 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Tobias Powalowski (tpowa)
Architecture All
Severity Medium
Priority Normal
Reported Version 0.7.2 Gimmick
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

[root@dublin samba]# ls
cores
log.nmbd
log.nmbd.1
log.nmbd.1.1
...

log.smbd
log.smbd.1
log.smbd.1.1
log.smbd.1.1.1
log.smbd.1.1.1.1
...

This is due to this line being in the logrotate configuration file:
/var/log/samba/log.* {

It needs to be rectified somehow to rotate only those that do not end in a number already. With the current settings these old logs are never deleted and could potentially overflow space constraints in /var/log. Perhaps since there are only two log files (at least in my system, I do not know if this is always true) it can be changed to list both:
/var/log/samba/log.nmbd /var/log/samba/log.smbd {
This task depends upon

Closed by  Tobias Powalowski (tpowa)
Thursday, 25 October 2007, 13:00 GMT
Reason for closing:  Fixed
Additional comments about closing:  3.0.26a-4 package
Comment by Dan McGee (toofishes) - Monday, 11 December 2006, 21:04 GMT
It may not be quite as easy as I thought, if you specify your logs to be similar to this:
log file = ...../log.%m
where a machine name is appended onto the log.
Comment by eliott (cactus) - Saturday, 16 December 2006, 23:53 GMT
the real problem is that it logs machine names as ip addresses sometimes (if the machine has no smb hostname or before resolution of one).
You can end up with log.192.168.1.1
Which will end up being a series of n log files after n series of logrotations. If it always logged hostnames, you could easily discern which files to rotate or not, but alas. There can be no guarantee that you will not see a valid log non-rotated logfile not ending in .X where X is an integer.

the easy solution might be to change the line in the smb.conf to something else.
perhaps...
log file = /var/log/samba/%m.log

Then you can have your smb logrotate script be..

/var/log/samba/log.{smbd,nbmd} /var/log/samba/*.log {
... original logrotate section ...
}

This is what I have done for my logrotate and samba setup.
Comment by eliott (cactus) - Saturday, 16 December 2006, 23:57 GMT
oops. looks like logrotate doesn't support full shell expansion.
This one works... i was typing from memory, instead of looking at my modified logrotate script.
heh..

/var/log/samba/log.smbd /var/log/samba/log.nbmd /var/log/samba/*.log {
Comment by Roman Kyrylych (Romashka) - Friday, 28 September 2007, 14:42 GMT
status?
Comment by Dan McGee (toofishes) - Thursday, 25 October 2007, 11:53 GMT
Typos bit us in the ass here- look at the original bug report vs. what Eliott typed.

It is "log.nmbd" and not "log.nbmd".
Comment by Tobias Powalowski (tpowa) - Thursday, 25 October 2007, 12:58 GMT
argh ...

Loading...