Bug#396003: patch for allowing the reporting of paniclog messages only once
On Thu, Feb 07, 2008 at 04:03:10PM +0100, Marc Haber wrote: > I have, in svn, implemented Josip's suggestion to have a dedicated > file /etc/logrotate.d/exim4-paniclog to allow manual rotation of the > paniclog. This could be called when E4BCD_WATCH_PANICLOG=once to > automatically move the log away, resulting in the following patch: > > > I'd appreciate you trying this patch and reporting back whether it > does what you suggest. May I remind? The patch is not yet committed. Greetings Marc -- - Marc Haber | "I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things."Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Bug#396003: patch for allowing the reporting of paniclog messages only once
On Sun, Dec 02, 2007 at 01:36:44PM +, Vasilis Vasaitis wrote: > Attached is a patch to exim4-base.cron.daily that implements what > has been described as an acceptable solution in this bug report: > > - If $E4BCD_WATCH_PANICLOG is set to "no", no reporting is done (no > change). > - If it is set to "yes", non-zero size paniclog is always reported > (no change again). > - If it is set to "once" however, a non-zero paniclog is reported > only if it has changed since the last time the cron.daily script has > run; so effectively only once for each time it changes. > > To implement this the script creates a zero size file in > /var/lib/exim4 called paniclog.timestamp, which would also mean that > the exim4-base package should contain /var/lib/exim4 (but this is just > nitpicking). I have, in svn, implemented Josip's suggestion to have a dedicated file /etc/logrotate.d/exim4-paniclog to allow manual rotation of the paniclog. This could be called when E4BCD_WATCH_PANICLOG=once to automatically move the log away, resulting in the following patch: --- debian/exim4-base.cron.daily(revision 2246) +++ debian/exim4-base.cron.daily(working copy) @@ -54,7 +54,7 @@ fi } -if [ "$E4BCD_WATCH_PANICLOG" = "yes" ]; then +if [ "$E4BCD_WATCH_PANICLOG" != "no" ]; then if [ -s "/var/log/exim4/paniclog" ]; then if [ -x "/usr/local/lib/exim4/nonzero_paniclog_hook" ]; then /usr/local/lib/exim4/nonzero_paniclog_hook @@ -64,6 +64,9 @@ if ! printf "Subject: exim paniclog on %s has non-zero size\nTo: root\n\nexim paniclog /var/log/exim4/paniclog on %s has non-zero size, mail system might be broken" "$(hostname --fqdn)" "$(hostname --fqdn)" | exim4 root; then log_this "PANIC: sending out e-mail warning has failed, exim has non-zero return code" fi + if [ "$E4BCD_WATCH_PANICLOG" != "once" ]; then +logrotate -f /etc/logrotate.d/exim4-paniclog + fi fi fi fi I'd appreciate you trying this patch and reporting back whether it does what you suggest. Greetings Marc -- - Marc Haber | "I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things."Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Bug#396003: patch for allowing the reporting of paniclog messages only once
Hi, Attached is a patch to exim4-base.cron.daily that implements what has been described as an acceptable solution in this bug report: - If $E4BCD_WATCH_PANICLOG is set to "no", no reporting is done (no change). - If it is set to "yes", non-zero size paniclog is always reported (no change again). - If it is set to "once" however, a non-zero paniclog is reported only if it has changed since the last time the cron.daily script has run; so effectively only once for each time it changes. To implement this the script creates a zero size file in /var/lib/exim4 called paniclog.timestamp, which would also mean that the exim4-base package should contain /var/lib/exim4 (but this is just nitpicking). Anyway, this first iteration is mostly meant to be a proof of concept implementation. Of course if you like it you can add it as it is, but I'm open to suggestions on how to make it better etc. Thanks, Vasilis -- Vasilis Vasaitis "A man is well or woe as he thinks himself so." --- exim4-base.cron.daily.orig 2007-11-21 15:29:05.0 + +++ exim4-base.cron.daily 2007-11-26 11:48:18.0 + @@ -54,17 +54,22 @@ fi } -if [ "$E4BCD_WATCH_PANICLOG" = "yes" ]; then +if [ "$E4BCD_WATCH_PANICLOG" != "no" ]; then if [ -s "/var/log/exim4/paniclog" ]; then -if [ -x "/usr/local/lib/exim4/nonzero_paniclog_hook" ]; then - /usr/local/lib/exim4/nonzero_paniclog_hook -fi -if [ -z "$E4BCD_PANICLOG_NOISE" ] || grep -vq "$E4BCD_PANICLOG_NOISE" /var/log/exim4/paniclog; then - log_this "ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken" - if ! printf "Subject: exim paniclog on %s has non-zero size\nTo: root\n\nexim paniclog /var/log/exim4/paniclog on %s has non-zero size, mail system might be broken" "$(hostname --fqdn)" "$(hostname --fqdn)" | exim4 root; then -log_this "PANIC: sending out e-mail warning has failed, exim has non-zero return code" +if [ "$E4BCD_WATCH_PANICLOG" != "once" ] || \ + [ ! -e "/var/lib/exim4/paniclog.timestamp" ] || \ + [ "/var/log/exim4/paniclog" -nt "/var/lib/exim4/paniclog.timestamp" ]; then + if [ -x "/usr/local/lib/exim4/nonzero_paniclog_hook" ]; then +/usr/local/lib/exim4/nonzero_paniclog_hook + fi + if [ -z "$E4BCD_PANICLOG_NOISE" ] || grep -vq "$E4BCD_PANICLOG_NOISE" /var/log/exim4/paniclog; then +log_this "ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken" +if ! printf "Subject: exim paniclog on %s has non-zero size\nTo: root\n\nexim paniclog /var/log/exim4/paniclog on %s has non-zero size, mail system might be broken" "$(hostname --fqdn)" "$(hostname --fqdn)" | exim4 root; then + log_this "PANIC: sending out e-mail warning has failed, exim has non-zero return code" +fi fi fi +touch /var/lib/exim4/paniclog.timestamp fi fi