Bug#504079: Logrotate: Mailfirst + delaycompress = error.

2008-10-31 Thread Paul Martin
tags 504079 confirmed
thanks
On Fri, Oct 31, 2008 at 10:19:09AM +0100, Jesús Feliz Fernández wrote:

 When you configure logrotate with mailfirst option and delaycompress, the
 program dont send the log to the specific email address, because it looks
 at for a .gz file, which doesnt exits (It hasn´t been compressed yet).

I suspect it's an interaction between mailfirst, delaycompress *and*
dateext.

I can confirm this...

With dateext the filename is set thus:

/* firstRotated is most recently created/compressed rotated log */
sprintf(firstRotated, %s/%s-%04d%02d%02d%s%s,
dirName, baseName, now.tm_year+1900,
now.tm_mon+1, now.tm_mday, fileext, compext);

Without dateext it's set like this:

sprintf(firstRotated, %s/%s.%d%s%s, dirName, baseName,
logStart, fileext,
(log-flags  LOG_FLAG_DELAYCOMPRESS) ?  : compext);


Notice how when datext is set it doesn't take into account
LOG_FLAG_DELAYCOMPRESS? It's an easy fix, but I'm afraid we may be far too
late for the fix to go into the lenny release.

-- 
Paul Martin [EMAIL PROTECTED]



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#504079: Logrotate: Mailfirst + delaycompress = error.

2008-10-31 Thread Jesús Feliz Fernández
Package: logrotate
Version: 3.7.1-3 
 
- System information:

# uname -a
Linux correo 2.6.18-6-amd64 #1 SMP Mon Oct 13 18:13:07 UTC 2008 x86_64 GNU/Linux

# dpkg -s libc6 | grep ^Version
Version: 2.3.6.ds1-13etch7

- Description:

When you configure logrotate with mailfirst option and delaycompress, the 
program dont send the log to the specific email address, because it looks at 
for a .gz file, which doesnt exits (It hasn´t been compressed yet).

It´s something about this in this closed bugreport:
  
Refer: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=186818 
 
- Bug reprodution:

* Edit /etc/logrotate.conf and add this lines with a real format email address:
 
/var/log/mail.log {
dateext
mailfirst
mail janzun.rosanegra dt rosanegra dt org
missingok
daily
rotate 365
create
compress
delaycompress
start 0
} 
 
* Executing logrotate you´ll see the error line:

# logrotate /etc/logrotate.conf -f
error: failed to open /var/log/mail.log-20081030.gz for mailing: No such file 
or directory 
 
Obviously file *gz doesnt exist because delaycompress is active and yesterday 
log isnt compressed.
 
- Bad solution: Comment delaycompress directive, but i dont like this.
 
- Temporary solution for me is to comment mail directive and run a tiny 
postrotate script like this:
 
/var/log/mail.log {
dateext
#mailfirst
#mail [EMAIL PROTECTED]
missingok
daily
rotate 365
create
compress
delaycompress
start 0
postrotate
 
T_FILE=${1}-$(date +%Y%m%d)
bzip2 -k $T_FILE
uuencode ${T_FILE}.bz2 ${T_FILE}.bz2 |mail -s Mail log subject 
here [EMAIL PROTECTED]
rm ${T_FILE}.bz2
 
endscript
 
}

Its some different that the original function, because I have yesterday log 
decompressed in the system but compressed in backup email, and archive.log is 
adjunted, not printed in body message.

- For a real and origin function reproduction, it should be:

# Script

postrotate

T_FILE=${1}-$(date +%Y%m%d)
echo $T_FILE |mail -s Mail log subject here [EMAIL PROTECTED] 

endscript

# /Script
  
Thank you very much for your effor maintaining this package, and sorry for my 
english.

Regards,
 
Jesús Feliz Fernández.
 



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]