1

I'm trying to send logs to my email. I'm doing this via SSH. I edited the file:

/usr/share/logwatch/default.conf/logwatch.conf

and edited these lines:

Output = mail
Format = html
Encode = none

MailTo = foo@bar.com

I have tried:

sudo logwatch

But the command just hangs there but is still responsive. E.g. I can still press enter to go to the next line.

I've tried doing it manually with:

sudo logwatch --detail Low --mailto email@address --service all --range yesterday

Same problem.

After a few minutes it stops and I can enter another command. I check my email but theres nothing from logwatch. Even in my spam/junk folder.

Any idea what's happening?

EDIT: I have iptables, fail2ban and ufw installed. If that makes any difference.

I have also tried:

echo "This is a test" | mail -s Testing foobar@gmail.com

I recieved the email in my spam folder. I feel like the problem is Logwatch.

1

Please have a look at your MTA's log files, e.g. /var/log/exim4/mainlog and watch out for SMTP errors.

I suggest this as I had a very similar situation, in which my e-mail provider's SMTP-server classified the e-mails produced by logwatch as spam, refusing to forward them. Other e-mails, as demonstrated by you, passed.

Workaround:

In my case it helped to save logwatch's output into a file and attaching it to an e-mail:

#!/bin/bash
tmpfile="/tmp/logwatch.txt"
/usr/sbin/logwatch > $tmpfile
echo "attached." | mail -s "logwatch output" -A "$tmpfile" email@provider

On debian, logwatch comes with a script scheduled by cron (located in /etc/cron.daily). You can use this snippet to modify it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.