Category: Amazon AMI

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