Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 144803 - app-admin/logrotate - when configured to mail logfiles before deleting them, an error is mailed instead
Summary: app-admin/logrotate - when configured to mail logfiles before deleting them, ...
Status: RESOLVED NEEDINFO
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Other
: High normal
Assignee: Daniel Gryniewicz (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-22 18:19 UTC by R. Welz
Modified: 2009-03-10 02:03 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description R. Welz 2006-08-22 18:19:29 UTC
for example in /etc/logrotate.d/syslog-ng

/var/log/slapd {
        olddir slapd_old
        daily
        compress
        dateext
        mailfirst
        mail systemmeldungen@fixe-post.de
        maxage 365
        rotate 365
        missingok
        notifempty
        create 640 root root
        sharedscripts
        postrotate
                /etc/init.d/syslog-ng reload
        endscript
}

gives this email:

error: mail command failed for /var/log/slapd_old/slapd-20060819.gz
error: uncompress command failed mailing /var/log/slapd_old/slapd-20060819.gz
                                                                       [ ok ]
 * Reloading configuration and re-opening log files ...                [ ok ]

Fortuna ~ # emerge --info
Portage 2.1-r2 (!/usr/portage/profiles/default-linux/x86/2006.0, gcc-3.4.6, glibc-2.3.6-r4, 2.6.16.26-xen i686)
=================================================================
System uname: 2.6.16.26-xen i686 Intel(R) Celeron(R) CPU 2.80GHz
Gentoo Base System version 1.12.4
dev-lang/python:     2.3.5-r2, 2.4.3-r1
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r3
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
CFLAGS="-O2 -march=pentium4 -mno-tls-direct-seg-refs -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control /var/www/localhost/htdocs/squirrelmail/plugins"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -march=pentium4 -mno-tls-direct-seg-refs -pipe"
DISTDIR="/mnt/nfs_portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/"
PKGDIR="/mnt/nfs_portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/mnt/nfs_portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="x86 alsa apm avi bitmap-fonts cli crypt ctype cups dba dri eds emboss encode esd expat fastbuild foomaticdb force-cgi-redirect ftp gd gdbm gif gpm gstreamer gtk gtk2 hal imlib jpeg libg++ libwww mad memlimit mikmod motif mp3 mpeg ncurses nls ogg opengl oss pam pcre pdflib perl png posix python quicktime readline sdl session simplexml soap sockets spell spl ssl symlink tokenizer truetype truetype-fonts type1-fonts udev unicode userlocales vorbis xml xmms xsl xv zlib elibc_glibc kernel_linux linguas_de linguas_en userland_GNU"
Unset:  EMERGE_DEFAULT_OPTS, PORTDIR_OVERLAY
Comment 1 R. Welz 2006-08-27 00:36:47 UTC
Ok, I am solving this on my own, but this will take some time, because I am a busy man ;)

First of all: Exchanging mailx with nail makes this work. It has 2 drawbacks: nail discards mail, when the smtp server is unreachable (e.g. network down).

And the From: header seems to be uncostumizable: 
From: cron <cron@Nausciaa.fit.de>  but I need 
From: cron@Nausciaa <bla,bla> since mail clients tend to show the first part only.

Comment 2 Daniel Gryniewicz (RETIRED) gentoo-dev 2006-08-27 09:36:50 UTC
Okay, so this is a mailx specific issue?  That certainly helps, because I was completely unable to see why the code wouldn't work.  It looks like it should be fine.

I can add support for customizing the from name, I think.
Comment 3 R. Welz 2006-09-01 18:29:16 UTC
Hi.
Yes, its mailx specific.

I have a workaround: nail works and you get a customizable "From" header if you put for example: 
from="cron-Merkur <cron-Merkur@Merkur.fixe-post.de>"
in /etc/crontab. logrotate inherits automagically.

But that works only if nail writes to a local postfix queue. With smtp to a remote server, nail doesn't use the "from" environment variable.

So you end up having postfix running on every computer.

Can we have something with mailx and costumizale from header? Its hard to read all the rotated logs when you have a dozend machines.

Robert
Comment 4 Daniel Gryniewicz (RETIRED) gentoo-dev 2006-09-14 07:27:54 UTC
Okay, I finally got a chance to try this, with that exact config (except my email address, and /var/log/messages), and it emailed the result to me correctly.

I looked, and mailx has no way to specify the full name, and it appears to incorrectly pass sendmail parameters through to ssmpt, so that doesn't work either.

Can you send email via mailx on the command line?  Is this still relevent at all?
Comment 5 Daniel Gryniewicz (RETIRED) gentoo-dev 2009-03-10 02:03:50 UTC
Please get back to me.