Logwatch – Change Subject – Amazon AMI

Amazon AMI, until 2013.03 uses, Logwatch version 7.3.6 that was released on 05/19/07 . That was very old. It doesn’t support letting us customize the subject line either. So, here is the trick

– Edit /usr/share/logwatch/scripts/logwatch.pl

– Search for the line that starts with ‘print OUTFILE’

– Replace that line with the following (copied from the latest version of this scripts)

#If $Config{'subject'} exists lets use it.
#This does not allow for variable expansion as the default below does -mgt
if ($Config{'subject'}) {
    print OUTFILE "Subject: $Config{'subject'}\n";
} else {
    print OUTFILE "Subject: Logwatch for $Config{'hostname'} (${OStitle})\n";

– Now, execute /etc/cron.daily/0logwatch

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s