Getting logrotate to email logs as attachments
A few years ago I set out to get logrotate to email log files as compressed attachments rather than emailing log files in pieces across multiple emails. I made a quick patch back then and mentioned it in this post to the NYLUG list but never got it up online for everyone. Over the past few years I’ve had a number of requests for this patch so here it is.
logrotate-3.3-email_attach.patch
Apply the patch to your source before compiling by running:
cd /path/to/logrotate-source/ patch -p1 < /path/to/patch/file/logrotate-3.3-email_attach.patch
The patch was made for logrotate 3.3. I have not tried to apply it against newer versions as logrotate’s emailing feature became less useful to me shortly after, but I’m sure it can’t be difficult to apply it to a newer release as it is quite a simple modification. Hopefully others out there will find this useful.