[Logcheck-commits] Hannes von Haugwitz: Added option to compress attachment with gzip

Hannes von Haugwitz hvh-guest at alioth.debian.org
Sat Feb 19 15:10:41 UTC 2011


Module: logcheck
Branch: master
Commit: 387d22f18f52324df5bf5e9fd36539e1c2daa5bd
URL:    http://git.debian.org/?p=logcheck/logcheck.git;a=commit;h=387d22f18f52324df5bf5e9fd36539e1c2daa5bd

Author: Hannes von Haugwitz <hannes at vonhaugwitz.com>
Date:   Sat Feb 19 15:53:33 2011 +0100

Added option to compress attachment with gzip

---

 debian/changelog  |    2 ++
 etc/logcheck.conf |    2 +-
 src/logcheck      |    4 ++++
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2c8b7a4..360740c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,8 @@ logcheck (1.3.14) unstable; urgency=low
   * ignore.d.server/dnsmasq:
     - allow '-' in interface name, thanks to Jan Evert van Grootheest
       (closes: #608256)
+  * src/logcheck, etc/logcheck.conf:
+    - added option to compress attachment with gzip
 
  -- Hannes von Haugwitz <hannes at vonhaugwitz.com>  Thu, 17 Feb 2011 06:43:37 +0100
 
diff --git a/etc/logcheck.conf b/etc/logcheck.conf
index aace461..4653c11 100644
--- a/etc/logcheck.conf
+++ b/etc/logcheck.conf
@@ -28,7 +28,7 @@ REPORTLEVEL="server"
 SENDMAILTO="logcheck"
 
 # Send the results as attachment or not.
-# 0=not as attachment; 1=as attachment
+# 0=not as attachment; 1=as attachment; 2=as gzip attachment
 # Default is 0
 
 MAILASATTACH=0
diff --git a/src/logcheck b/src/logcheck
index db618eb..ac75c1c 100755
--- a/src/logcheck
+++ b/src/logcheck
@@ -304,6 +304,10 @@ sendreport() {
           debug "Sending report as attachment"
           eval mime-construct $MIMECONSTRUCTARGS --subject "'$subject'" --encoding "7bit" --string "'Report attached'" --to "$SENDMAILTO" --attachment "logcheck_report" --encoding "7bit" --file "$TMPDIR/report"
           return $?
+        elif [ "$MAILASATTACH" -eq 2 ]; then
+          debug "Sending report as gzip attachment"
+          eval mime-construct $MIMECONSTRUCTARGS --subject "'$subject'" --encoding "7bit" --string "'Report attached'" --to "$SENDMAILTO" --type "application/x-gzip" --attachment "logcheck_report.gz" --file "'gzip -c $TMPDIR/report |'"
+          return $?
         fi
         eval mime-construct $MIMECONSTRUCTARGS --subject "'$subject'" --to "$SENDMAILTO" --encoding "7bit" --file "$TMPDIR/report"
     fi




More information about the Logcheck-commits mailing list